How to Remove “Sort by Popularity” in WooCommerce: A Beginner’s Guide
Are you looking to customize your WooCommerce store and want to remove the “Sort by Popularity” option from the product listing? You’ve come to the right place! This guide will walk you through several easy methods to achieve just that.
Why might you want to do this? Maybe popularity isn’t the most important factor for your customers, and you’d rather focus on things like price, recent arrivals, or ratings. Perhaps you want to curate a specific shopping experience. Whatever your reason, let’s dive in!
Understanding the “Sort by Popularity” Option
Before we remove it, let’s understand what the “Sort by Popularity” option does. In WooCommerce, it orders products based on the number of purchases they’ve had. This can be helpful for highlighting best-selling items, but it’s not always the best strategy for every store.
Think of it like this: A brand-new store selling handcrafted goods might not benefit from showing the same popular item over and over again. They might want to feature new arrivals or products with the best customer reviews.
Method 1: Using the WooCommerce Settings (Quickest and Easiest)
Believe it or not, WooCommerce offers a built-in option to control which sorting methods are available. This is the recommended method for beginners because it doesn’t require any code changes!
1. Log in to your WordPress admin dashboard.
2. Navigate to WooCommerce > Settings.
3. Click on the “Products” tab.
4. Scroll down to the “Default Product Sorting” section.
5. You’ll see a dropdown menu. Choose a different default sorting option (e.g., “Default sorting,” “Popularity (sales),” “Rating,” “Date,” or “Price (asc/desc)”).
6. Below the dropdown is an option called “Enable product sorting.” Uncheck this box. It removes the sorting options completely.
7. Save your changes by clicking the “Save changes” button at the bottom of the page.
This method effectively disables all sorting, including “Sort by Popularity.” If you only want to remove “Sort by Popularity” but keep other options, move on to the next method.
Method 2: Using a Code Snippet (More Control)
This method involves adding a small piece of code to your WordPress theme. This is a slightly more advanced approach, but it gives you more control.
Important: Before making any code changes, it’s always a good idea to back up your website. This way, you can easily restore it if something goes wrong. You should also use a child theme to avoid losing your changes when the parent theme updates.
1. Access your `functions.php` file. You can do this through your WordPress admin panel by going to Appearance > Theme File Editor (ensure you’re editing your child theme). Alternatively, you can use an FTP client.
2. Add the following code snippet to the bottom of your `functions.php` file:
function remove_popularity_sorting( $sort_options ) { unset( $sort_options['popularity'] ); return $sort_options; } add_filter( 'woocommerce_catalog_orderby', 'remove_popularity_sorting' );
3. Save the `functions.php` file.
Explanation:
- `remove_popularity_sorting()`: This is a custom function we’re creating.
- `$sort_options`: This variable contains an array of all the available sorting options in WooCommerce.
- `unset( $sort_options[‘popularity’] );`: This line removes the “popularity” sorting option from the array.
- `return $sort_options;`: This returns the modified array (without the “popularity” option).
- `add_filter( ‘woocommerce_catalog_orderby’, ‘remove_popularity_sorting’ );`: This line “hooks” our function into the `woocommerce_catalog_orderby` filter, which is responsible for displaying the sorting options.
Read more about How To Refund An Order Woocommerce
Real-life example: Imagine you’re running a store selling vintage clothing. You might prefer to showcase items based on their uniqueness or rarity (which could be reflected in price) rather than their popularity, making this method ideal.
Method 3: Using a Plugin (Easiest for Non-Coders)
If you’re not comfortable editing code directly, you can use a plugin to remove the “Sort by Popularity” option. There are many free and paid plugins available that allow you to customize your WooCommerce store, including controlling sorting options.
Steps:
1. Install and activate a WooCommerce customization plugin. Examples include: “WooCommerce Product Sorting” or “Custom Product Sort for WooCommerce” (search in the WordPress plugin repository: Plugins -> Add New). Read reviews and choose one that fits your needs.
2. Configure the plugin to remove the “Sort by Popularity” option. The exact steps will vary depending on the plugin you choose, but generally, you’ll find a settings panel where you can disable or re-order the available sorting options.
3. Save the plugin settings.
Reasoning: Plugins offer a user-friendly interface, making it easy to customize your WooCommerce store without having to write any code. This is perfect for users who are not familiar with PHP or WordPress development. However, be cautious about installing too many plugins, as they can slow down your website.
Testing Your Changes
After implementing any of these methods, be sure to test your changes by visiting your shop page Read more about How To Hide Product Price In Woocommerce and verifying that the “Sort by Popularity” option is no longer displayed in the sorting dropdown.
Conclusion
Removing the “Sort by Popularity” option from your WooCommerce store is a relatively simple process that can have a significant impact on the shopping experience you provide. By using the built-in settings, a code snippet, or a plugin, you can easily customize your store to better reflect your brand and your customers’ needs. Choose the method that best suits your technical skills and comfort level, and enjoy a more personalized shopping experience for your customers! Remember to always back up your site before making changes, and use a child theme when editing code. Good luck!