Shopify themes, liquid, logos, and UX
Hi,
I want to make it so that a message displays at the top of the cart page if the customer has added two products with a praticular tag - the message would say that if they add one item to the cart then they would receive a £5 discount. I know I can use an app, but they all look a bit naff and I don't like pop-ups on the cart.
I have already tried using the following code taken from a website, the code is for displaying a message if they spend a certain amount more then they get free shipping.
{% comment %} Add this snippet to your theme's cart.liquid file before <form></form> {% endcomment %}
<div class="cart-alert">
<h5>
{% if cart.total_price < 4900 %}
<span style="font-weight: 900; color: #9fa615;">Have your eye on anything else?</span> If you spend {{ 4900 | minus: cart.total_price | money }} more, you qualify for free U.S. shipping!
{% else %}
<span style="font-weight: 900; color: #9fa615;">Hooray!</span> Your order qualifies for free U.S. shipping! Enjoy the savings.
{% endif %}
</h5>
</div>
My plan was to alter that code to make it so that a different message is displayed when two items with the tag 'personalised message' are in the cart. I attempted this (see below) but it isn't working - I'm a complete beginner at coding!
{% comment %} Add this snippet to your theme's cart.liquid file before <form></form> {% endcomment %}
<div class="cart-alert">
<h5>
{% if item.product.tags contains 'zwparcel' and item.quantity = 2}
<span style="font-weight: 900; color: #155E2C;">Have your eye on anything else?</span> If you add one more Zero Waste Parcel to your cart, you qualify for a £5 discount!
{% endif %}
{% endif %}
</h5>
</div>
Can any one help to adjust it so that it works?
My website URL is zwparcels.thecleankilo.co.uk
Thanks
Tom
Hey there @TCK,
I don't see why the second code SHOULD WORK? I mean you've not added any popup code etc.? Please share the link where you got the first/unmodified code and also share what steps you took to post the code in your theme.
Since you are a complete beginner you'll probably need developer assistance getting this done. You can contact me if you need my help.
Hi UmairA,
Don't worry about it - I went for static line of text for now.
I didn't particularly want it to be a pop-up like a light box, just for the text to appear if they added two qualifying items to the cart.
Thanks for your help anyway!
Tom
We appreciate the diverse ways you participate in and engage with the Shopify Communi...
By JasonH Sep 9, 2024Thanks to everyone who participated in our AMA with 2H Media: Marketing Your Shopify St...
By Jacqui Sep 6, 2024The Hydrogen Visual Editor is now available to merchants in Shopify Editions | Summer '...
By JasonH Sep 2, 2024