Comments 3natah started the conversationApril 7, 2022 at 7:55amHi! I tried the following code to make changes at woocommerce but nothing is working. can you please check and correct the code ?/*** @snippet Remove Sorting Option @ WooCommerce Shop* @ https://businessbloomer.com/bloomer-armada/*/add_filter( 'woocommerce_catalog_orderby', 'bbloomer_remove_sorting_option_woocommerce_shop' ); function bbloomer_remove_sorting_option_woocommerce_shop( $options ) { unset( $options['popularity'] ); unset( $options['menu_order'] ); return $options;} // Note: you can unset other sorting options by adding more "unset" calls... here's the list: 'menu_order', 'popularity', 'rating', 'date', 'price', 'price-desc'-------------------------------------------/*** @snippet Rename a Sorting Option @ WooCommerce Shop* @ https://businessbloomer.com/bloomer-armada/*/ add_filter( 'woocommerce_catalog_orderby', 'bbloomer_rename_sorting_option_woocommerce_shop' ); function bbloomer_rename_sorting_option_woocommerce_shop( $options ) { $options['price'] = 'Low to High Price'; $options['price-desc'] = 'High to Low Price'; return $options;}------------------------------------------- 2,958Andrew repliedApril 7, 2022 at 11:27amHi Natah,Could you try and attach the filter with the priority and number of arguments attached.We mean for example:add_filter( 'woocommerce_catalog_orderby', 'bbloomer_remove_sorting_option_woocommerce_shop', 10, 1 ); 10 is the priority and 1 is the number of arguments.Also could you check with the source of this code as they are in a better position to assist.Thanks. 3natah repliedApril 7, 2022 at 3:51pmit is working!thank you for your help1 Like Sign in to reply ...
Hi!
I tried the following code to make changes at woocommerce but nothing is working. can you please check and correct the code ?
/**
* @snippet Remove Sorting Option @ WooCommerce Shop
* @ https://businessbloomer.com/bloomer-armada/
*/
add_filter( 'woocommerce_catalog_orderby', 'bbloomer_remove_sorting_option_woocommerce_shop' );
function bbloomer_remove_sorting_option_woocommerce_shop( $options ) {
unset( $options['popularity'] );
unset( $options['menu_order'] );
return $options;
}
// Note: you can unset other sorting options by adding more "unset" calls... here's the list: 'menu_order', 'popularity', 'rating', 'date', 'price', 'price-desc'
-------------------------------------------
/**
-------------------------------------------* @snippet Rename a Sorting Option @ WooCommerce Shop
* @ https://businessbloomer.com/bloomer-armada/
*/
add_filter( 'woocommerce_catalog_orderby', 'bbloomer_rename_sorting_option_woocommerce_shop' );
function bbloomer_rename_sorting_option_woocommerce_shop( $options ) {
$options['price'] = 'Low to High Price';
$options['price-desc'] = 'High to Low Price';
return $options;
}
Hi Natah,
Could you try and attach the filter with the priority and number of arguments attached.
We mean for example:
add_filter( 'woocommerce_catalog_orderby', 'bbloomer_remove_sorting_option_woocommerce_shop', 10, 1 );
10 is the priority and 1 is the number of arguments.
Also could you check with the source of this code as they are in a better position to assist.
Thanks.
it is working!
thank you for your help