I want to inject a discount code into a URL. Beyond just filling in on the checkout page, I want the discounted prices to be shown while the user browses the site.
How do I code something like this?
I want to inject a discount code into a URL. Beyond just filling in on the checkout page, I want the discounted prices to be shown while the user browses the site.
How do I code something like this?
Hi Josh,
To automatically apply a discount code on the checkout page you need to prepare following URL
[https://{shop_name}.myshopify.com/discount/{discount_code}](https://{shop_name}.myshopify.com/discount/{discount_code})
replacing shop_name and discount_code according to your needs.
You can also get this link from the admin panel:
Unfortunatelly, I don’t know how to show the discounted prices on product pages. Would love to learn.
HTH,
Lukasz
Thanks for offering to help Lukasz but that’s not what I want.
I want all prices to be slashed on the site and show the price after discount while users browse.
Hi Josh,
The discount code is stored in the cookie so you could have variables defined in your site script that can be cross referenced to apply a discount. It does mean you would need to define your codes twice but it’s better than not having the functionality at all.
You would still need to use the link that Lukasz pointed out above so that the code was stored in the first place, and it means you would need an obvisous notice so that users know why the store prices are changing in front of them.
As far as I’m aware there isn’t a way to do this through liquid.
If you need a hand with implementation I’m available through elliot@mandelbrotian.com
Cheers,
Elliott
All you have to do is add this to end of your URL:
?discount=your_discount
ex: http://www.yourshop.com/collections/all/my-product?discount=savefive
It’s great for social media, cause you can take them right to the product without needing them to memorize a discount code til they checkout.
Stevo, simply adding "?discount=your_discount" to the URL didn’t work for me.
What does work is to use the discount permalink, with a redirect. For example:
**https:///discount/?redirect=/products/<**your product>
or
https:///discount/?redirect=/collections//products/
I tested this works for Shopify checkout, including Amazon and Paypal express checkout. It doesn’t work for our recurring checkout through ReCharge, though, which is a bummer. Not sure if it would work with other 3rd party / app checkouts.
I am generating a an actiavation URL to activate account in FB mesenger… I would like to auto apply a discount after they set their password from the activating URL we send them… How would you append the discount to this URL?
https://apple.myshopify.com/account/activate/207119551/e002775fd4cda67d1a6bafcc8c132a1f-1571256934"
[quote=“Doug-from-Maine”]
Stevo, simply adding "?discount=your_discount" to the URL didn’t work for me.
What does work is to use the discount permalink, with a redirect. For example:
https://**
I’m a few months too late to the show Doug, but thanks for the solution, saved me such a headache here, you have no idea
It works. I creted a discount code buy x get y, and a permalink with 2 producst and aded at the end of permalink ?discount=my_discount code
Easy ! Here is a code to add discount to actual page url inside liquid if it help someone : {{ shop.url }}/discount/?redirect={{ request.path }}
I’m trying to use this same structure to apply a discount code to a product that I’m adding to the cart via permalink URL. So basically from the URL I want to end up on the payment page with code applied. Without the code this structure works.
https://
While this goes to the cart it doesn't add the discount code. Any ideas?
```css
https://
The disount is applied automatically in checkout, not in cart.
Not great and bit desorienteing for customer but the simplest is to tell them the discount will be deducted in the next step.
Thanks Man ![]()
Actually the discount is added on Desktop automatically, but not working in this sequence on mobile… unfortunatelly.
e.g.
<site_url>/discount/<discount_code>?redirect=/cart/<product_unique_id>:1?channel=buy_button
All works fine on Desktop - Chrome & Mozzila
Doesn’t work when in Private mode & on Safari (no matter if Private or not)
Mobile - I have tested only on iPhone and it doesn’t work.
*By not working - I mean that product is added to cart, but discount is not applied automatically.
So - if someone has updated or working option for Mobile devices or without redirect (because this won’t work in general on Private browsing) - would be strongly appreciated ![]()
Hey @LukaszWiktor
Can you please tell me where you got this link from?
https://{shop_name}.myshopify.com/discount/{discount_code}
I have been looking for this in the docs but I couldn’t find anything like this.
Thanks!
Go to DISCOUNTS → Select active discount → upper right corner you will see “Promote” and Get Shareable link…
I spoke to Shopify about this → It turns out that when adding redirect, platform clears cookies and this is why it would never work.
oh no…
so there is no way to do this?
Hi @abdullah_omar04 ,
As @Sve_FB already replied, you can find it under Discount > Promot > Get a sharable link
In the Shopify docs, it’s described in the article titled Managing discount codes.
I just tested the link on mobile (Android/Chrome), and it worked correctly.
Thank you so much for the screenshot!
@LukaszWiktor