This topic has 2 replies, 2 voices, and was last updated 2 years, 5 months ago ago by Olga Barlow
Hi, 8theme.
How sorting items in Mini-cart type right menu from Z-A (reverse_cart_contents)? Use this code but after have issues with add quantity input products.
revers items in cart and mini cart
function reverse_cart_contents() {
$cart_contents = WC()->cart->get_cart_contents();
if($cart_contents) {
$reversed_contents = array_reverse($cart_contents);
WC()->cart->set_cart_contents($reversed_contents);
}
}
add_action('woocommerce_before_mini_cart', 'reverse_cart_contents');
add_action('woocommerce_after_mini_cart', 'reverse_cart_contents');
add_action('woocommerce_before_cart', 'reverse_cart_contents');
add_action('woocommerce_after_cart', 'reverse_cart_contents');
add_action('woocommerce_review_order_before_cart_contents', 'reverse_cart_contents');
add_action('woocommerce_review_order_after_cart_contents', 'reverse_cart_contents');
Thanks
Best, Paul
Hello,
Try this solutions https://www.8theme.com/topic/showing-latest-product-at-the-top-of-the-side-cart-rather-than-bottom/
Regards
Tagged: items, mini-cart, right menu, sorting, themes, woocommerce, wordpress
You must be logged in to reply to this topic.Log in/Sign up