Apparently the code of yours did not do the trick. It’s still displaying the the code regardless. I’m now previewing with only one product in cart when this should be impossible to see. Maybe I have not explained well, so I’ll make it into a scenario.
In my current cart there is only one item, this item contains “poster” tag. When I view the cart I do not see the code. I remove this product from the cart now. I am then adding a product that contains the “frames” tag. I am still not able to see the code when I view the cart. I then add a product with poster tag and I when I am to view the cart I see the code.
Note that product tags are available only in the cart template. The GET /cart call has no support for items[].product_tags. Instead, one must grab items[].handle (not items[].product_id or items[].product_handle as one might assume with standard object selection methods or consistent naming conventions) and pass it to the GET /products/{product-handle} call to get tags[].
Time to see if I can keep multiple parallel callbacks in order while iterating the cart and triggering a series of /cart/updates. This should also make for an amusing customer experience under certain circumstances. My apologies in advance to anyone who might be epileptic as I have potentially lost the ability to make a single refresh.
I need to check that particular product is in cart or not, for that I have used same code as per you given but when I add multiple products in cart at that time this code is not working, This code is worked only for single product.
Can you please help me for multiple products in cart ?
Here I am sharing my code, please review it and help me.
I am working on product detail page dawn theme and in top of the file I have mentioned this code so on whole file I can use this variable and assign class based on this variable for any section.
{% assign productID = product.id %}
{% assign productInCart = 'false' %}
{% for item in cart.items %}
{% if item.product.id == productID %}
{% assign productInCart = 'true' %}
{% else %}
{% assign productInCart = 'false' %}
{% endif %}
{% endfor %}
--------------From here default product detail page code this is working fine when single product in cart but when multiple products in cart it is not working--------------------
Sorry to keep dragging this thread out, but I’m having some issues and I can’t find a near-solution anywhere.
In my cart, I have a div for a Proof Request (custom items) with a dynamic Add To Cart button.
By clicking this button “ADD +” it will add the Proof Request product to the cart on the same page and change itself to a green non-clickable “ADDED ✓” button.
That all works great, BUT my issue is if there are multiple line items in the cart (without Proof Request added) then the “ADD +” button duplicates itself per line item. Of course once any of the duplicated “ADD +” buttons are clicked it runs fine and shows a single “ADDED ✓” button as it should.
Here’s the snippet currently in my cart-main-footer.liquid: (removed styling)