Last active
February 4, 2019 23:18
-
-
Save bekarice/3b0f0a0def79e32bff3e to your computer and use it in GitHub Desktop.
Remove WooCommerce Sorting Options
This file contains 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
/** | |
* Reference post: http://www.skyverge.com/blog/remove-woocommerce-default-sorting-option/ | |
*/ | |
/** | |
* Removes "Default Sorting" from the shop template | |
* | |
* Can be used to unset other keys / sorting options instead | |
* Ref: https://github.com/woothemes/woocommerce/blob/master/includes/wc-template-functions.php#L654 | |
*/ | |
function skyverge_remove_default_sorting_option( $catalog_orderby_options ) { | |
unset( $catalog_orderby_options['menu_order'] ); | |
return $catalog_orderby_options; | |
} | |
add_filter( 'woocommerce_catalog_orderby', 'skyverge_remove_default_sorting_option' ); | |
/** | |
* Removes "Default Sorting" option from the Product Settings | |
* | |
* Can be used to unset other keys / sorting options instead | |
* Ref: https://github.com/woothemes/woocommerce/blob/master/includes/admin/settings/class-wc-settings-products.php#L256 | |
*/ | |
function skyverge_remove_default_sorting_from_settings( $options ) { | |
unset( $options['menu_order'] ); | |
return $options; | |
} | |
add_filter( 'woocommerce_default_catalog_orderby_options', 'skyverge_remove_default_sorting_from_settings' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment