[Resolved] Hide cart in secondary menu when its empty

Home Forums Support [Resolved] Hide cart in secondary menu when its empty

Home Forums Support Hide cart in secondary menu when its empty

  • This topic has 9 replies, 4 voices, and was last updated 1 month ago by Leo.
Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #2053766
    Daniele

    Hello,
    I moved the cart in the secondary menu with this filter:

    add_filter( ‘generate_woocommerce_menu_item_location’, ‘tu_move_menu_cart_item’ );
    function tu_move_menu_cart_item() {
    return ‘secondary’;
    }

    and I would like to hide it if it is empty. How can I accomplish it?

    thank you

    #2054060
    Elvin
    Staff
    Customer Support

    Hi there,

    Try adding this CSS:

    span.menu-bar-item.wc-menu-item:not(.has-items) {
        display: none;
    }

    A wise man once said:
    "Have you cleared your cache?"

    #2054755
    Daniele

    Hello,
    no luck with this,
    this is my website: (private information)

    #2054860
    Ying
    Staff
    Customer Support

    Can you link us to a product page where we can see secondary navigation and the navigation cart?

    Let me know ๐Ÿ™‚

    #2054863
    Daniele

    Hi,
    just to be sure,
    this is the cart I would like to hide when it is empty: https://imgur.com/a/1YcHrog

    #2054869
    Leo
    Staff
    Customer Support

    I checked a few pages but don’t see the secondary navigation.

    Can you link us to the specific page in question?

    Thanks.

    #2054875
    Daniele

    Hi,
    the navigation is on all the pages of the website (top bar)
    You can see the cart top right.

    Please check: (private info)

    #2054878
    Leo
    Staff
    Customer Support

    Try this CSS instead:

    .secondary-navigation .wc-menu-item:not(.has-items) {
        display: none;
    }
    #2054887
    Daniele

    it works with important

    .secondary-navigation .wc-menu-item:not(.has-items) {
        display: none !important;
    }
    #2054902
    Leo
    Staff
    Customer Support

    Glad to hear ๐Ÿ™‚

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