[Resolved] Cart Icon display

Home Forums Support [Resolved] Cart Icon display

Home Forums Support Cart Icon display

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1020164
    Alan Gautham

    Using the below snippet from this forum to hide cart icon when it is empty.

    add_filter( 'generate_woocommerce_menu_item_location', 'tu_hide_empty_cart_icon' );
    function tu_hide_empty_cart_icon( $location ) {
        if ( class_exists( 'WooCommerce' ) && sizeof( WC()->cart->get_cart() ) > 0 ) {
            return $location;
        }
    
        return 'none';
    }

    ISSUE: When adding product from single product page, cart icon appears.
    But when adding products from shop page or category page. Cart icon appears only after manually refreshing the page.
    It would be great if it appears instantly as like single product page.
    Thank you.

    #1020389
    David
    Staff
    Customer Support

    Hi there,

    maybe the CSS option would work better in this case – which i provided here:

    https://generatepress.com/forums/topic/show-cart-items-in-navigation/#post-1014294

    #1020533
    Alan Gautham

    Hi David

    That CSS did the job perfectly. Thanks a lot.
    Also, Thank you for your niche template which I am using on this site. Your custom tweaks look great on shop pages. Nice detailed work!

    #1020574
    David
    Staff
    Customer Support

    Awesome – and thank you for the feedback really nice to hear that – made my day.

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.