All things Shopify and commerce
Hi,
Im using DAWN theme and I try to add a notification in the cart for customers to get notified if they add 1 more product to the cart they get x % amount of discount.
Can I do this with coding?
Solved! Go to the solution
This is an accepted solution.
Hi PDventures, you can add this to your `main-cart-items.liquid` file:
{% if cart.item_count == 4 %}
<h2 class="title title--primary">
Add 1 more product to the cart to get an x% discount!
</h2>
{% endif %}
Replace 4 with the amount of items the customer needs in their cart to get the discount, minus 1. So in the code example above, the customer would be getting a discount at 5 items.
I recommend pasting this just below the {% if cart != empty %} line.
Best,
Tobe
This is an accepted solution.
Hi PDventures, you can add this to your `main-cart-items.liquid` file:
{% if cart.item_count == 4 %}
<h2 class="title title--primary">
Add 1 more product to the cart to get an x% discount!
</h2>
{% endif %}
Replace 4 with the amount of items the customer needs in their cart to get the discount, minus 1. So in the code example above, the customer would be getting a discount at 5 items.
I recommend pasting this just below the {% if cart != empty %} line.
Best,
Tobe
Thank you for the reply Tobe.
just 1 more thing, will this reset the message (or remove) when there are 2 or more items in the card without refreshing the page?
The entire page will not refresh. In Dawn, when the cart is updated, just the `main-cart-items` section reloads, from what I can tell.
Thank you it worked
Is there a way to center it and change the color of the text?
Yes, you can use CSS. Try the `text-align` and `color` properties. I recommend using ChatGPT to add these styles to the code I gave you.
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