Support » Plugin: Menu Item Visibility Control » Something in cart?

Viewing 3 replies - 1 through 3 (of 3 total)
  • That’s funny, I was trying to do exactly the same thing.
    First I tried is_cart()
    But that only makes the cart and checkout menus visible if you are on the cart page.
    Otherwise they go away again . . . that’s not the desired functionality i’m looking for.

    Since the plugin says it’s like Widget Logic only for menus, I asked the Widget Logic author to confirm my logic is correct.

    If I echo
    global $woocommerce; var_dump($woocommerce->cart->cart_contents_count); it returns int(0) if the cart is empty and an integer greater than 0 if it has contents.

    So my “widget logic” is
    global $woocommerce; return ( $woocommerce->cart->cart_contents_count > 0);

    Logically this should show the Cart and Checkout menu items only if the cart has contents, however the menus display whether the cart has contents or not. Also tried !==0 with the same results.

    I, too, would like to see an answer to this.

    If you require assistance then, as per the Forum Welcome, please post your own topic instead of tagging onto someone else’s topic.

    I am now closing this 11 month old topic.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Something in cart?’ is closed to new replies.