I created a script that will check if an specific product is in my cart for do something but is not working… If anybody can tell me what is wrong in my code will be very helpful…
{% for item in cart.items %}
{% if item.product.id == "8223550921" %}
<div><h1>Some text here!</h1></div><br>
{% endif %}
{% endfor %}
Note: I tested this a lot of time using the product.title and many other options and doesn’t work neither.
3
Answers
I found a solution myself. The point was that I was using the wrong object. I was using the cart object but I'm working in the checkout page so take a look to the solution:
Thanks for the help received! - Abel.
You can try this instead
Check this cheat for further use of line item properties
As product id is integer so you should use it as (removing quotes from product-id):-