How can I show this ‘add to cart’ element ONLY when the cart is empty? So that it is hidden when there are any items in the cart?
Hello @threeoten,
Thanks for writing in!
You can use the Number Condition {{dc:woocommerce:cart_items}}
that is greater than 1.
This should hide away the add to cart
when the cart is empty.
Kindly let us know how it goes.
Thanks, I tried that and it doesn’t work. Greater than 1 means the element would still show if there was 1 item in the cart, right? Wouldn’t the correct condition be:
show if {{dc:woocommerce:cart_items}} is greater than 0 ? (basically saying “only show the element when the cart is empty”
Either way, no variation seems to work. It’s wither showing on both, or hidden on both depending on what condition I use. It makes no sense to me.
Hello @threeoten,
The dynamic content code for the cart item count would work globally in the builder so you can set the condition using this dynamic content code on any elements.
Thanks
Sorry, I misunderstood.
I tried that and it doesn’t work. Greater than 1 means the element would still show if there was 1 item in the cart, right? Wouldn’t the correct condition be:
show if {{dc:woocommerce:cart_items}} is greater than 0 ? (basically saying “only show the element when the cart is empty”
I also tried …cart items = 0, which also doesn’t work.
Either way, no variation seems to work. It’s wither showing on both, or hidden on both depending on what condition I use. It makes no sense to me.
I added login to secure note if you want to take a look.
Hello @threeoten,
You can use the String condition instead:
The condition:
{{dc:woocommerce:cart_items_raw}} is 0
Kindly let us know how it goes.
Thanks, that seems to work. What is the difference between {{dc:woocommerce:cart_items_raw}} and {{dc:woocommerce:cart_items}}?
Hello @threeoten,
The {{dc:woocommerce:cart_items_raw}}
returns taw raw number while the {{dc:woocommerce:cart_items}}?
returns an HTML value with the number in it.
Cheers.
This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.