instagram rss arrow-down

WooCommerce stores with a few products do not often need the sort dropdown menu on the shop and product pages. In fact, the sort option is considered an unwanted part of the UI. A related element is the standard notice of the number of items/results.

Fortunately, removing these elements are easy to remove. In this tutorial, I will show the simple process of removing these two UI elements. Here is how the store looks before the changes are applied:

To start, confirm that default sorting is enables. if not, enable it from the backend. Go to Settings > Products > Display and then to Default product sorting. Select any option from the menu.

To make the changes, open up the functions.php file and add the following code snippets:

remove_action( 'woocommerce_before_shop_loop', 'woocommerce_result_count', 20 );
This snippet will remove the notice that shows the number of results.

remove_action( 'woocommerce_before_shop_loop', 'woocommerce_catalog_ordering',30 );

This snippet will remove the default sorting dropdown from all pages

function delay_remove() {
    remove_action( 'woocommerce_after_shop_loop', 'woocommerce_catalog_ordering', 10 );
    remove_action( 'woocommerce_before_shop_loop', 'woocommerce_catalog_ordering', 10 );
This snippet removes the default sorting dropdown in StoreFront Theme

Here is how the shop page would look like after the addition of the snippets:

The post An Easy Guide On How To Remove Default Sort Option in WooCommerce appeared first on WPblog.

Source link

Support New Articles with a Sweet Tee

Leave a Reply
Your email address will not be published. Required fields are marked *