Hello, in the shopping cart home page where the products are displayed, how do I change the topics that appear in the dropdown under “Sort By”?
EX:
(See example if screenshot in Private Content area)
Essentially I think I’ll only want them to be able to sort by Name and/or Product ID
Alternatively, is there a way to get rid of the sort features on that page in case I don’t want them?
Thank you
Hey robertbwc,
Try adding this code to the end of your child theme functions.php file in Appearance ▸ Editor:
function my_woocommerce_catalog_orderby( $orderby ) {
unset($orderby["default"]);
unset($orderby["menu_order"]);
unset($orderby["price"]);
unset($orderby["date"]);
unset($orderby["popularity"]);
unset($orderby["rating"]);
unset($orderby["rand"]);
unset($orderby["relevance"]);
return $orderby;
}
add_filter( "avf_wc_product_order_dropdown_frontend", "my_woocommerce_catalog_orderby", 20 );
it will remove all except Name & ID
Best regards,
Mike
That’s amazing, thank you! Currently it’s displaying by 100, 200 and 300 products in the “Display” dropdown. How can I change that to 10, 20 and 30?
Alternatively, if I wanted to remove “Display” dropdown, how can I do that?
Hi,
Glad that this helped, in my install the “Display” dropdown shows 15, 30, 45:
I didn’t find a way to change it, but you can remove it with this css in your Quick CSS:
.product-sorting > .sort-param.sort-param-count {
display: none;
}
Please ensure to copy the code from the forum and not an email notification so the symbols are not converted.
After applying the css, please clear your browser cache and check.
Best regards,
Mike