Created
January 4, 2017 18:32
-
-
Save rayrutjes/2402d3957fc99bd22773d64d3e7e63a0 to your computer and use it in GitHub Desktop.
Remove sorting options from WooCommerce
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'woocommerce_catalog_orderby', function( $wc_options ) { | |
$remove_sort_options = array( | |
'popularity', | |
'rating', | |
'date', | |
'price', | |
'price-desc', | |
); | |
foreach ( $remove_sort_options as $option ) { | |
if ( isset( $wc_options[$option] ) ) { | |
unset( $wc_options[$option] ); | |
} | |
} | |
return $wc_options; | |
} ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment