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]
- Get User Login Data (date, time… )
- Run wp_kses_decode_entities on atom feed?
- Filtering out the #more anchor link that gets produced by
- Registration Hooks don’t appear to be working
- Can’t filter wp_get_attachment_link
- Woocommerce “added to cart” message on main(home) page
- Redirect to another page using contact form 7? [closed]
- append to existing parent theme function
- jQuery does not work
- Why does re-using this function not work? [closed]
- help I changed one currency in woocommerce and everything is ruined [closed]
- Pass parameter to hooked function using custom page template
- Functions when woocommerce isn’t installed
- How to override woocommerce.css?
- Add Element as a Filter to the_content
- Modify post filter to set custom number of posts per page and exclude child posts
- How to return hook data when multiple parameters are present?
- Hook into a function without a hook?
- Make wp_link_pages() suitable for Twitter Bootstrap markup
- How can I add a filter for specific categories on functions.php?
- What is the text that appears beside the page titles in the list of pages in the WP admin?
- How to add custom JavaScript in functions?
- Setting a default text for excerpts of a particular category
- How can I use Woocommerce $product->get_attribute in functions.php? (if at all)
- How would I go about replacing this function in my child theme located in inc/template-tags.php
- Retrieve a value from Yoast SEO to use to set a default twitter card image honoring overrides
- Is my code correct to enqueue CSS on a specific page?
- How to change this simple code so that it sends the email notification after payment in WooCommerce?
- Remove an action by extending class and replacing it
- Add_filter when value is no variable?
- Control the srcset much more (not all sizes in it each time)
- Filter yoast canonical add_action priority [closed]
- Filter an WordPress Function in (general-template.php)
- Adding bootstrap classes to video shortcodes
- How do I hook into the container of wp_nav_menu?
- Remove links from the_content when using filters wp_trim_excerpt
- Redefine function arguments before rendering
- Is there a way to prevent a function/method from being called outside a specific hook?
- How to edit classes in body tag?
- Auto log in hook is requiring a page refresh
- Filter nav menu items HTML tags and wrap inner text with span
- Call to undefined function is_home() or any conditional tags
- Function not working inside of a function in functions.php
- WooCommerce change Tax Class programmatically when Recalculating an existing Order [closed]
- How can I add a class to a nav li depending on URL?
- Create custom function for hero image
- Modify gform_other_choice_value for specific form and specific field in Gravity Forms
- Redirect no product url’s to static url
- Adding code before post title with the_title produces weird results
- Add back in child theme what the parent theme removed with remove_action
- replace text in Sort Box
- Combine embed_oembed_html and oembed_result
- login_headertitle is deprecated since version 5.2.0
- Set “woocommerce_is_purchasable” to false for specific “$product->is_stock_status”
- How to have different site identity logos on each page on Astra Theme [closed]
- add_filter to specific WooCommerce Category
- Woocommerce checkout field
- Writing a function to detect an event
- What Hook/Action is performed when a field in checkout form is changed in WooCommerce
- How to display the_archive_title() and the_archive_description() – “weird” interaction
- Filter to wp_list_authors
- Woocommerce image sizes missing from Appearance › Customize but not declared by theme
- add referrer to woo
- How to add custom li item to wordpress menu