Liquid, JavaScript, themes, sales channels
We sell two separate categories of products on our store. One has the tag 'Treatment Couches' the other doesn't.
We want to display one message if a customer adds a product with the 'Treatment Couches' tag to their cart, and a different one if they don't.
If they have a Treatment Couch, it should only display the 'Treatment Couch' message.
Currently the add to cart pop up is showing a message for each product.
This is the code that is there at the moment:
{% for item in cart.items %}
{% if item.product.tags contains 'Treatment Couches' %}
{% if forloop.first %}
<p><b><em><span style="color:#00AEEF;">A member of the team will contact you to arrange delivery of your couch to suit you. Please refer to the product page for more details.</span></em></b></p>
{%- else -%}
<p><b><em><span style="color:#00AEEF;">Orders placed before 1pm are dispatched the same day. Orders placed after 1pm on a Friday will be dispatched on the following Monday.</span></em></b></p>
{% endif %}
{%endfor%}
Solved! Go to the solution
This is an accepted solution.
Hi @PortRobot,
You can try the following code:
{% assign check = 0 %}
{% for item in cart.items %}
{% if item.product.tags contains 'Treatment Couches' %}
{% assign check = 1 %}
{% break %}
{% endif %}
{% endfor %}
{% if check == 1 %}
<p><b><em><span style="color:#00AEEF;">A member of the team will contact you to arrange delivery of your couch to suit you. Please refer to the product page for more details.</span></em></b></p>
{% else %}
<p><b><em><span style="color:#00AEEF;">Orders placed before 1pm are dispatched the same day. Orders placed after 1pm on a Friday will be dispatched on the following Monday.</span></em></b></p>
{% endif %}
This is an accepted solution.
Hi @PortRobot,
You can try the following code:
{% assign check = 0 %}
{% for item in cart.items %}
{% if item.product.tags contains 'Treatment Couches' %}
{% assign check = 1 %}
{% break %}
{% endif %}
{% endfor %}
{% if check == 1 %}
<p><b><em><span style="color:#00AEEF;">A member of the team will contact you to arrange delivery of your couch to suit you. Please refer to the product page for more details.</span></em></b></p>
{% else %}
<p><b><em><span style="color:#00AEEF;">Orders placed before 1pm are dispatched the same day. Orders placed after 1pm on a Friday will be dispatched on the following Monday.</span></em></b></p>
{% endif %}
Thanks @LitExtension this worked perfectly!
Another semi-related question, how do I change the title of the cart pop up to "Shopping Basket", it is currently "Shopping Cart"
Hi @PortRobot,
Can you send me the name of the theme you are using or your store link. I will check it.
Hello,
If you want to solve this issue without any changes in the theme try to use
Product Warnings on Checkout . It would be great to show the warning only for products that are different from others. There is also a line item property in the app that is displayed on the cart page after the warning was accepted.
Portrait of Stephen positioned next to an image of planet Earth, with the Stephen's World ...
By JasonH Mar 18, 2024Digital marketers and app developers have tracked activity in apps and websites for yea...
By Ollie Mar 13, 2024February was an exciting month with Shopify Editions, informative webinars, and more! F...
By JasonH Mar 7, 2024