Hello there,
I’m working on my cart page using a layout and I’m almost done, but I’m having an issue with cart conditions. The way I’m doing my cart is by creating two full-width columns in my row, one to be displayed when the cart has items in and another when the cart is empty (so I can display a custom message about the empty cart). Here is my setup:
1. Column 1: Cart has items in it (contains normal “Cart” element)
Condition: Number type {{dc:woocommerce:cart_items_raw}} > 0
2. Column 2: Cart is empty (contains custom icon, message, button)
Condition: Number type {{dc:woocommerce:cart_items_raw}} == 0
So, for the most part, the setup works great…until you empty the cart from the cart page. The page is emptied via an AJAX fragment, Column 1 disappears, but Column 2 does not appear. If I refresh the page, Columns 2 appears, but that’s not good UX. I really want it to show after I remove the last item from the cart.
So, I suppose there could be two possible solutions.
- Somehow get the conditional in Column 2 to read the new cart count (ideal)
- Get the cart to refresh the page when the last item is removed.
Any advice? I’m honestly not sure if there’s a bug with the conditional or whether the AJAX fragments are messing with it or a combination of both!