How to remove some options from the “sort-by” list in WooCommerce

  • Log into FTP/File Manager, go to wp-content/themes/themeXXXXX/includes folder to open custom-function.php file:
  • Add this code to the bottom of custom-function.php file, before the closing code ?>
    // Edit WooCommerce dropdown menu item of shop page//
    // Options: menu_order, popularity, rating, date, price, price-desc
     
    function my_woocommerce_catalog_orderby( $orderby ) {
        unset($orderby["price"]);
        unset($orderby["price-desc"]);
        return $orderby;
    }
    add_filter( "woocommerce_catalog_orderby", "my_woocommerce_catalog_orderby", 20 );

    Each unset($orderby[“field_from_Options”]); will remove the section that you need, just replace field_from_Options with the field you need.

    You can choose the field name from the following options: menu_order, popularity, rating, date, price, price-desc.

  • Save the file and refresh the site to see the changes: