Skip to content

Instantly share code, notes, and snippets.

@bekarice
Last active February 4, 2019 23:18
Show Gist options
  • Save bekarice/3b0f0a0def79e32bff3e to your computer and use it in GitHub Desktop.
Save bekarice/3b0f0a0def79e32bff3e to your computer and use it in GitHub Desktop.
Remove WooCommerce Sorting Options
/**
* 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