You can use the filter below, as suggested by @sabarnix at
add_filter('woocommerce_get_catalog_ordering_args', 'tk_woocommerce_catalog_orderby');
function tk_woocommerce_catalog_orderby( $args ) {
if( is_product_category( 'shirts' ) ) {
$args['orderby'] = 'meta_value_num';
$args['order'] = 'ASC';
$args['meta_key'] = '_price';
}
return $args;
}
Related Posts:
- Issues with title-tag and document_title_parts
- Define custom Page Template without its own .php file
- How to influence the information displayed on widget inside wp-admin
- In WooCommerce I need to modify the thankyou.php page [closed]
- How can I add an extra WooCommerce hook
- Remove Page Title from Static Frontpage
- Hide some items from Screen options in dashboard for products
- Issue adding text after short description on product pages Woocommerce [closed]
- Exclude Empty Child Categories in Menu
- Increment price for Woocommerce Minicart [closed]
- Gravity Forms field entries into wp_query loop [closed]
- Accepted arguments value in hook functions
- Get current page_id before loop, in functions.php
- Which action hook to use for function?
- Modify a function without editing template
- Passing values from a widget to a function within a plugin
- Add to cart php not working [closed]
- What did I do wrong in my functions code, that will not change the “Get New Password” text to “Send It”?
- Replace a menu with widget or a custom template file programmatically
- woocommerce change currency per category [closed]
- Override the WordPress core function wp_referer_field
- How to edit the Tags within the image file URLs?
- Can’t properly set the_title add_filter to show short_URL
- How to add_filter html template to middle of content
- Possible to hook into Media Library preview File column and use a custom image?
- Is it possible to use add_filter in an included file in the child theme’s functions.php?
- Insert Content Before div#main from the functions.php File
- Add Adsense code between job listings – wp job manager plugin
- Changing the text of Upload/Insert on Posts and Pages Screen
- Save_post – Warning: Cannot modify header information
- custom error message for empty username and password using authenticate filter not working
- How Do I Unhook This Parent Theme Function?
- add product thumbnail to checkout page only and include variation name
- Which method is more correct for removing WooCommerce Extensions menu item?
- Force resize for all video content
- Copy and Modified WooCommerce function is_coupon_valid [closed]
- Remove Actions/Filters added via Anonymous Functions
- Import WordPress XML File from Within Functions.php
- How to get woocommerce inventory status [closed]
- Is there a hook or function I can use to display all theme files being used on a current page?
- opening links in new tab using – add_filter( ‘the_content’, ‘make_clickable’);
- Implementing DNS Prefetching with WordPress
- Is it possible to use a forgot password url filter?
- How to remove “out of stock” variation options from size dropdown in woocommerce?
- Set default options for inserting media
- How to hook into the quick edit action?
- Override a class function to include a custom template
- display 100 products per page on product category page [closed]
- Adding WooCommerce to a Custom Theme – not working [closed]
- WooCommerce add_action hook results in 500 error
- Woocommerce Shipping module available only for type of products [closed]
- Override woocommerce wc-class function
- Post Pagination Showing Same Posts Every Page
- WordPress after content Hook & external template part
- str_replace function in theme
- Pass info from functions.php to plugin
- Inserting a functions output after the content
- Handling Body class based on Template
- Don’t delete a page if it holds users
- How to add nav menu items to a specific position within a menu
- How to add a slide toggle to the Woocommerce-Layout__Activity-Panel area in the orders admin page
- Is it possible to intercept all ajax requests and get the parameters and the returns?
- Is possible add icon in title posts only in specific tag?
- WordPress Gravatar filter is removing my custom attributes
- How to auto refresh when user change postcode
- Adding an external HTML link to a post thumbnail
- Footer disappears when using the_content ( )
- Why does re-using this function not work? [closed]
- How to override woocommerce.css?
- Make wp_link_pages() suitable for Twitter Bootstrap markup
- Setting a default text for excerpts of a particular category
- How can I use Woocommerce $product->get_attribute in functions.php? (if at all)
- Add_filter when value is no variable?
- Call to undefined function is_home() or any conditional tags
- Add Login/Logout Menu Item to Primary Nav “My Account” Submenu [Woocommerce] [closed]
- Redirect to woocommerce checkout after adding to cart – item already in cart
- Hook for altering the content of all wp mails
- Must filter functions receive all arguments passed to them?
- Conditional custom menu?
- Get URLs for AJAX Filter Checkboxes WordPress
- Display custom product option in admin order details
- Variation prices breakdown only for single product page
- Filter works on last selection but no others
- When are the user meta fields created in the database? Admin vs Woo API REST
- is_product_category(‘Services’) not working
- Parent category as WOOCommerce Categories widget title
- Problem with my footer after changing WooCommerce Products Sorting [closed]
- Prevent function from triggering on current page
- Assign IDs to headings in ACF using functions.php
- Add suffix to price html does not work
- Redirect specific author posts to another url
- Show number of sold products but be first for less than 2
- True email confirmation for registration (keeping unvalidated users from user table)
- function syntax is off,
- Best way to add image to recent posts widget?
- Print all inline styles to head
- Init hook for header send
- How to add custom checkout field in user details mail template
- How do I add functionality to images?
- Assign new post author IF another user in custom field on post transition