WordPress.org

Ready to get started?Download WordPress

Forums

Menu Item Visibility Control
[closed] Something in cart? (4 posts)

  1. EzRiIgK
    Member
    Posted 1 year ago #

    Hey,

    Not really fimiliar with codex. So was hoping someone who is could give me what i need.
    Want to show my "view cart" and "Checkout" menu items only if something has been added to the cart.
    Don't know if site url is needed but its: FJsHandbags.com

    Thanks Erik

    http://wordpress.org/extend/plugins/menu-items-visibility-control/

  2. jimlongo
    Member
    Posted 1 year ago #

    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.

  3. DatagoniaWeb
    Member
    Posted 3 months ago #

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

  4. esmi
    Forum Moderator
    Posted 3 months ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags