G’day.

I'm Zac, an ecommerce digital marketer. I build brands and deliver performance for fledgling, growing, and dominating businesses.

How To Automatically Apply A Discount Code To A Link In Shopify

This is a super common request: you want customers to have a discount applied already when they click on a link to your store.

Shopify does give you a link to the discount itself from the Promote button inside the discount but this just takes you to your home page.

Why is this helpful?

Ultimately one of the core tenets of successful ecommerce is making sure that it’s as easy as possible for a customer to give you money.

That means removing as much friction as possible — like making sure they don’t have to navigate through your mega menu to get to the product they just clicked on in your email.

There’s a way to automatically apply a discount code to a customer’s cart once they land on your website and send them to a different page on your website than the home page.

Note: This guide is written specifically for Shopify, as per the title.

Discount Link Syntax

The way to create these custom discount links is pretty simple. You just have to break down the discount link syntax and then apply a redirect.

Default discount syntax, if this website was a Shopify website, would be like this:

zacvanmanen.com/discount/{{DISCOUNT}}

{{DISCOUNT}} is, of course, the discount code itself. Whether it’s “birthday10”, “freeshipping”, “sorry20” or whatever, that’s how Shopify structures default shareable discount code links. But we can add a redirect!

Redirecting Shopify Discount Links

/?redirect=/ is the next part of the puzzle. What this does is apply a redirect, as per the name, to the original link while passing information about the initial request (e.g., the original page, search terms) to the target page (eg., the end destination).

To apply this to a Shopify discount code we simply add it to the end of our default discount link. Again, if this website was a Shopify website, it would look like this:

zacvanmanen.com/discount/{{DISCOUNT}}/?redirect=/

In this instance, we’d be redirected to the home page because it’s the root directory (/) of the website. I won’t go into website file structure here, don’t worry.

Basically you want to rip off the end of your destination URL — everything after the forward slash (/) in the link — and paste that onto the end.

Example below.

How to redirect shopify discount links to a specific page

Let’s assume we have an email that we want to send out to customers with a discount code autoapplied once they click the hero image and the big Shop Now button above the fold. Let’s also assume we want customers to land on our Best Sellers Collection.

Let’s also assume, for ease, our discount code is SAVE40 for a fake 40% off code.

If this website was a Shopify store with the above assumptions made, our link would look like:

zacvanmanen.com/discount/SAVE40/?redirect=/collections/best-sellers

Let’s break that link down some more with some bolded emphasis so you can understand how it works.

  1. zacvanmanen.com/discount/SAVE40/?redirect=/collections/best-sellers

    This is our website’s home page. Simple.
  2. zacvanmanen.com/discount/SAVE40/?redirect=/collections/best-sellers

    This is the discount that we want to automatically apply. You can either manually write your discount code in here if you know what it is, or you can go into Shopify > Discounts > click on your discount > get your link from the Promote button (provided your discount is live).
  3. zacvanmanen.com/discount/SAVE40/?redirect=/collections/best-sellers

    This is the part of the URL that will handle the redirection of the discount link so you can drive customers as close to your end goal as possible.
  4. zacvanmanen.com/discount/SAVE40/?redirect=/collections/best-sellers

    This is where our redirect will actually send traffic.

How Do redirects work?

It’s basically what it sounds like: you’ll get redirected to the proper page. You won’t load the initial page and then load the final page, don’t worry. You will load a server response from the initial page — correct me if I’m wrong — but it won’t force your browser to load two pages when it should only load one.

Your SEO might tell you to minimise the number of redirects on the website and that’s not bad advice. Google doesn’t love huge volumes of redirect links.

How should I use automatically applying discount links on shopify?

This kind of automatically applied discount link is best used for ads and emails rather than as links live on your website. This is for a few reasons:

  1. It’s easy to turn access to these discounts on/off. You can turn the discount itself off and then turn off your ad and stop emailing the link out. This way there’s no expectation from customers that it will keep working.
  2. Related, it won’t be a little anchor link that sites like Honey will latch onto to take away your margin.

Hope this helps!

For more freelance Shopify ecommerce support, whether creative or technical, get in touch.

;

Discover more from Zac van Manen

Subscribe now to keep reading and get access to the full archive.

Continue reading