WooCommerce Sorting + Showing....Results Hardcoded by Pro

Two requests -

  1. Can you guys stop hardcoding the Sorting box and Showing [x] Results boxes that appear at the top of category browsing pages? None of the Woo-provided functions to remove these from the loop work because Pro puts them back in.
  2. Since the normal functions (shown below) do not work with Pro, do you have replacement functions that will do the same when using Pro?

// Remove the sorting dropdown from Woocommerce
remove_action( ‘woocommerce_before_shop_loop’ , ‘woocommerce_catalog_ordering’, 30 );
// Remove the result count from WooCommerce
remove_action( ‘woocommerce_before_shop_loop’ , ‘woocommerce_result_count’, 20 );

Thanks!

Hello @co50,

Thanks for writing in!

Please be advised that the mentioned functions were not in any way hard coded in the Pro or X theme. It just that you have done it incorrectly. The proper way of remove those element is by using this code instead:

function remove_woo_elements(){
  // Remove the sorting dropdown from Woocommerce
  remove_action( 'woocommerce_before_shop_loop' , 'woocommerce_catalog_ordering', 30 );
  // Remove the result count from WooCommerce
  remove_action( 'woocommerce_before_shop_loop' , 'woocommerce_result_count', 20 );
}
add_action('wp', 'remove_woo_elements');

Hope this helps. Kindly let us know.

Thanks my man. Strange, the code I pasted in the OP worked on TwentySeventeen theme but not on Pro so I assumed Pro added it back in or changed the hook or something. Nonetheless, your solution totally works. Thank you sir!

Glad we could help and you’re most welcome! Cheers!

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.