How to Modify Product Sorting in WooCommerce – 2026

Last updated on October 30th, 2024 at 09:55 am

WooCommerce offers several default product sorting options, such as sorting by popularity, rating, and price. However, depending on your store’s needs, you may want to customise the product sorting to highlight certain products or create a more personalised shopping experience for your customers.

In this guide, we’ll show you how to modify the product sorting options in WooCommerce using custom code. As always, we recommend adding any custom code to your child theme to ensure your changes are safe from theme updates.

Why Modify Product Sorting?

Customising product sorting can:

  • Highlight Key Products: Promote specific products at the top of the list, such as bestsellers or new arrivals.
  • Improve User Experience: Tailor the sorting options to align with your customers’ needs.
  • Boost Conversions: Direct customers to the products most likely to convert by displaying them prominently.

Step 1: Remove Unwanted Sorting Options

WooCommerce offers several built-in sorting options. If some of these are unnecessary, you can remove them with the following code:

/*
 * Snippet: How to Modify Product Sorting in WooCommerce – 2026
* Author: John Cook
* URL: https://wcsuccessacademy.com/?p=1585
* Tested with WooCommerce 10.7.0
* "This function removes unwanted sorting options in WooCommerce"
*/ function wcsuccess_remove_sorting_options( $sorting_options ) { unset( $sorting_options['popularity'] ); // Remove 'Sort by popularity' unset( $sorting_options['rating'] ); // Remove 'Sort by average rating' return $sorting_options; } add_filter( 'woocommerce_catalog_orderby', 'wcsuccess_remove_sorting_options' );

How This Code Works

  • unset() Function: This function removes unwanted sorting options by their keys (e.g., 'popularity' and 'rating').
  • Filter Hook: The woocommerce_catalog_orderby filter ensures that only the desired sorting options are displayed.

Step 2: Add Custom Sorting Options

To enhance the shopping experience, you may want to add new sorting options, such as sorting by the latest product arrivals or specific product attributes.

/*
 * Snippet: How to Modify Product Sorting in WooCommerce – 2026
* Author: John Cook
* URL: https://wcsuccessacademy.com/?p=1585
* Tested with WooCommerce 10.7.0
* "This function adds custom sorting options to WooCommerce"
*/ function wcsuccess_add_custom_sorting_options( $sorting_options ) { $sorting_options['latest'] = __( 'Sort by latest arrivals', 'woocommerce' ); return $sorting_options; } add_filter( 'woocommerce_catalog_orderby', 'wcsuccess_add_custom_sorting_options' );

How This Works

  • Custom Sorting Option: The new sorting option, 'Sort by latest arrivals', is added to the product sorting dropdown.
  • Language Translation Support: The __() function ensures the text can be translated if needed.
See also  How to Add WooCommerce Quick View Without a Plugin – 2026

Step 3: Set a Default Sorting Option

You can set a new default sorting option to improve the browsing experience by guiding customers toward a specific selection.

/*
 * Snippet: How to Modify Product Sorting in WooCommerce – 2026
* Author: John Cook
* URL: https://wcsuccessacademy.com/?p=1585
* Tested with WooCommerce 10.7.0
* "This function sets a default sorting option in WooCommerce"
*/ function wcsuccess_set_default_sorting( $sort_by ) { return 'price'; // Set the default sorting to 'Sort by price' } add_filter( 'woocommerce_default_catalog_orderby', 'wcsuccess_set_default_sorting' );

How This Works

  • Default Sorting: The code sets the default sorting to 'price'. You can change 'price' to any other sorting key (e.g., 'latest' or 'popularity').

Step 4: Use Shortcodes to Display Products with Custom Sorting

If you want to display products sorted by specific criteria within a page or post, you can use a WooCommerce shortcode:

echo do_shortcode('[products orderby="price" order="asc"]');

This shortcode displays products sorted by price in ascending order. You can modify the orderby and order parameters to suit your needs.

Best Use Cases for Custom Sorting

  • Seasonal Promotions: Highlight seasonal products by adding custom sorting options, such as “Winter Collection” or “Summer Deals.”
  • New Arrivals: Ensure customers see the latest products by setting the default sorting to “Latest Arrivals.”
  • Personalised Shopping: If your store offers specific product categories (e.g., electronics or fashion), add sorting options that cater to these segments.
See also  How to Sort by Featured Products on the Shop Page in WooCommerce - 2026

Conclusion

Customising product sorting in WooCommerce helps you create a tailored shopping experience for your customers. By removing unnecessary sorting options, adding new ones, and setting default criteria, you can highlight key products and boost conversions.

Always test your changes on a staging site before applying them to your live store. Use a child theme to ensure your modifications aren’t lost during theme updates. For further WooCommerce customisations, check out our WooCommerce Visual Hooks Guide and wp-config generator.

0 0 votes
Article Rating

Stay In Touch

Was this post helpful? Why not show your support and buy me a coffee?

Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Scroll to Top
0
Would love your thoughts, please comment.x
()
x
×