Hide Cart Button When Empty Using Conditions?

Is there a way yet to hide a [Woo] cart button if there are no items in the cart? I couldn’t find any conditions that would provide for this…

Hello @co50,

Thanks for writing to us.

In case if you are using the X theme, you can go to X—>Theme Option —>WooCommerce–>Navbar Car–>Hide when empty.
Theme-Options-X (2)

In case if you are using the Pro theme and custom Header, you can set the condition on the element by dynamic content code “{{dc:woocommerce:cart_items}}”. it would return the number of cart items.

header-menu-Headers-Pro (4)

Please have a look at our condition and assignment operator doc.

Hope it helps
Thanks

Hi,

I’m using Pro. I tried what you said but it does not work.

Selecting the condition of Number and filling in the equation as:

{{dc:woocommerce:cart_items}} > 0

Which dictates that the element should display if the number of items in the cart is greater than 0…

…results in the cart never being displayed regardless of whether there are items in it or not. What is the proper equation here?

Hello @co50,

Sorry for the confusion you can use this dynamic content code on the element
{{dc:woocommerce:cart_items_raw}} to set the condition.

Your condiotion would be like this {{dc:woocommerce:cart_items_raw}} > 0

If it doesn’t work for you, Please share your details in a secure note. Please provide the following details

  • WordPress Login URL
  • Admin level username and password

You can find the Secure Note button at the bottom of your posts

Thanks

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.