How to remove sort types in WooCommerce

The following types of product sorting are available by default in WooCommerce:

  • Sort by default;
  • sorting by the last added products;
  • sorting by product rating;
  • sorting by popular products;
  • Sort by price;
  • sort by descending price.

Not always all types of sorting are needed, and here's how to remove them:

add_filter('woocommerce_catalog_orderby','in_woocommerce_catalog_orderby');

function in_woocommerce_catalog_orderby($args){
    unset($args['popularity']);
    unset($args['rating']);
    return $args;
}

In this case, we have removed the sorting by rating and popularity.

List of names of all types of sorting:

array(
   'menu_order' => __( 'Default sorting', 'woocommerce' ),
   'popularity' => __( 'Sort by popularity', 'woocommerce' ),
   'rating'     => __( 'Sort by average rating', 'woocommerce' ),
   'date'       => __( 'Sort by latest', 'woocommerce' ),
   'price'      => __( 'Sort by price: low to high', 'woocommerce' ),
   'price-desc' => __( 'Sort by price: high to low', 'woocommerce' ),
)

 


Updated: 24.01.2019

Did this article help you? Rate it!
(No Ratings Yet)
Loading...


Leave a Reply

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