Notify customers they need to add 1 more item to the cart to get a discount

Solved

Notify customers they need to add 1 more item to the cart to get a discount

PDventures
Tourist
4 0 1

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?

Accepted Solution (1)

tobebuilds
Shopify Partner
415 28 110

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

Founder, Regios Discounts app (4.9 stars)
- Custom discounts made simple
- "Just about any discount you'll ever need"
- Built by an ex-Google software engineer

View solution in original post

Replies 6 (6)

tobebuilds
Shopify Partner
415 28 110

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

Founder, Regios Discounts app (4.9 stars)
- Custom discounts made simple
- "Just about any discount you'll ever need"
- Built by an ex-Google software engineer
PDventures
Tourist
4 0 1

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?

tobebuilds
Shopify Partner
415 28 110

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.

Founder, Regios Discounts app (4.9 stars)
- Custom discounts made simple
- "Just about any discount you'll ever need"
- Built by an ex-Google software engineer
PDventures
Tourist
4 0 1

Thank you it worked

PDventures
Tourist
4 0 1

Is there a way to center it and change the color of the text?

tobebuilds
Shopify Partner
415 28 110

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.

Founder, Regios Discounts app (4.9 stars)
- Custom discounts made simple
- "Just about any discount you'll ever need"
- Built by an ex-Google software engineer