Showing applied discount on the cart

Highlighted
Shopify Partner
125 0 15

Hello, 

I am wondering if anyone knows how to add an overview of what discount code is being applied to a purchase, on the cart page. To clarify: I don't want the ability to add a discount code on the cart page, I want to just show what discount will be applied at checkout, if a customer came from a discount link for example. 

Ideally I would like it to show the discount code applied, the amount saved, and calculate the new subtotal price. 

I am comfortable enough with coding to be able to calculate everything, I just need to know how to pull the discount information. 

Thanks in advance

0 Likes
Highlighted
Shopify Partner
125 0 15

After thinking through this, if need be I guess I could just set a client side cookie if they come through a discount link. And then pull that cookie info on the cart.

 

but I’m wondering if this is the best option?

edit: 

For now I did this using vanilla javascript. If anyone is curious:

as of the time of this post when you use the promotion link for shopify, it sets a cookie under the name discount_code. you could use this, but you don't know when shopify might change that. So i have added a url paramater to my discount code links. And I use that to set my own cookie client side, then on the cart page used a js script to detect if that cookie is present, and if it is then to calculate the discount and inject the html. Probably not the best solution, but it is working for the time being.

0 Likes
Highlighted
New Member
1 0 0

Do you mind sharing how you did this with JS? Curious if the coupon code goes through the codes in the shopify db and is able to allocate the correct valuation for all products or if its just doing a discount that you set by percentage for all products.

0 Likes
Highlighted
Excursionist
12 0 4

 

Today, You have the ability to add discount coupons on your cart page.

I came across an app that shows the amount of discount applied and the total price value. Its called Kart Discount.

 

c.png

 

https://apps.shopify.com/discount-coupon-field-in-cart-page

0 Likes
Highlighted
New Member
1 0 1

Hi @kevindavid

 

I just downloaded it. It works well. I was looking for an app that could help my customers apply discounts on the cart page in my store and this one was perfect for me. I saw a few more apps that were good but this was very simple and gave me a permanent solution. Thank you.

1 Like
Highlighted
New Member
10 0 0

I was also looking for some liquid code which helps me to add a discount box to my cart drawer and stumbled upon an app Dcart

It's quite fast and has good reviews. Here is how my cart looks now:

 

Screen Shot 2020-09-21 at 19.22.03.png

 

Here is the link to an app:

https://apps.shopify.com/discount-in-cart 

0 Likes