Shopify discount links automatically apply promo codes when customers visit your store. No need to copy-paste codes—just share the link and the discount appears at checkout.
Key Takeaways
- 1Use /discount/CODE format to auto-apply discounts
- 2Redirect to any page after applying the discount
- 3Discounts persist in the customer's session
- 4Works with percentage, fixed amount, and free shipping codes
- 5Create the discount code in Shopify Admin first
Basic Discount Link
The simplest Shopify discount link follows the /discount/CODE pattern. When a customer clicks this link, Shopify automatically applies the discount to their cart and redirects them to your store.
https://yourstore.myshopify.com/discount/SAVE20<a href="https://yourstore.myshopify.com/discount/SAVE20">
Get 20% Off - Shop Now
</a>This link applies the SAVE20 discount code and sends the customer to your homepage. They see the discount in their cart when they add products.
Redirect After Discount
By default, discount links redirect to your homepage. Adding the redirect parameter lets you send customers directly to a specific collection, product, or even the cart page for a smoother buying experience.
Add a redirect parameter to send customers to a specific page:
https://yourstore.myshopify.com/discount/SUMMER25?redirect=/collections/saleThe table below shows common redirect destinations and how to format the URL path for each.
| Redirect Target | URL Example |
|---|---|
| Homepage | /discount/CODE?redirect=/ |
| Collection | /discount/CODE?redirect=/collections/summer |
| Product | /discount/CODE?redirect=/products/best-seller |
| Cart | /discount/CODE?redirect=/cart |
Redirecting to the cart is useful when customers already have items saved. They see their cart with the discount pre-applied, ready to check out.
Common Campaign Links
These examples show how different businesses use discount links for marketing campaigns. Each scenario demonstrates a specific strategy for driving conversions.
Influencer Partnership
https://yourstore.myshopify.com/discount/INFLUENCER15?redirect=/collections/featuredGive each influencer a unique code so you can track which partnerships drive the most sales. The redirect lands them on products the influencer has promoted.
Email Campaign
https://yourstore.myshopify.com/discount/EMAIL10?redirect=/products/new-arrival&utm_source=email&utm_campaign=welcomeAdding UTM parameters lets you track email campaign performance in Google Analytics alongside the discount redemption data in Shopify.
Direct to Cart
https://yourstore.myshopify.com/discount/FREESHIP?redirect=/cartThis pattern works well for abandoned cart recovery emails. The customer returns to their saved cart with the free shipping incentive already applied.
Building Links Dynamically
When you need to generate discount links programmatically, such as for personalized email campaigns or affiliate systems, use this JavaScript function to handle URL construction.
function createShopifyDiscountLink(options) {
const { store, discountCode, redirect, utmParams } = options;
const baseUrl = `https://${store}/discount/${discountCode}`;
const url = new URL(baseUrl);
if (redirect) {
url.searchParams.set('redirect', redirect);
}
if (utmParams) {
Object.entries(utmParams).forEach(([key, value]) => {
url.searchParams.set(key, value);
});
}
return url.toString();
}
// Usage
const link = createShopifyDiscountLink({
store: 'mystore.myshopify.com',
discountCode: 'WELCOME20',
redirect: '/collections/all',
utmParams: {
utm_source: 'facebook',
utm_medium: 'paid',
utm_campaign: 'spring_sale'
}
});This function combines your discount code with optional redirect and tracking parameters into a properly formatted URL. Use it in your backend or marketing automation tools.
React Component
If you are building a custom storefront or landing page with React, this component provides a clean interface for creating discount buttons with consistent behavior.
interface ShopifyDiscountButtonProps {
store: string;
discountCode: string;
redirect?: string;
children: React.ReactNode;
className?: string;
}
function ShopifyDiscountButton({
store,
discountCode,
redirect,
children,
className
}: ShopifyDiscountButtonProps) {
const href = useMemo(() => {
let url = `https://${store}/discount/${discountCode}`;
if (redirect) {
url += `?redirect=${encodeURIComponent(redirect)}`;
}
return url;
}, [store, discountCode, redirect]);
return (
<a href={href} className={className}>
{children}
</a>
);
}
// Usage
<ShopifyDiscountButton
store="mystore.myshopify.com"
discountCode="VIP25"
redirect="/collections/exclusive"
>
Claim Your VIP Discount
</ShopifyDiscountButton>The component uses useMemo to efficiently build the URL and properly encodes the redirect path to handle special characters.
Creating Discount Codes in Shopify
Before you can use discount links, you need to create the discount codes in Shopify Admin. The discount link feature works with any discount code you create, regardless of the discount type.
Go to Discounts
In Shopify Admin, navigate to Discounts in the left sidebar
Create discount code
Click Create discount → Discount code (not automatic)
Set your code name
Use memorable codes like SAVE20, WELCOME15, or VIP25
Configure discount type
Choose percentage, fixed amount, free shipping, or buy X get Y
Once created, your discount code works immediately with the link format. There is no additional setup needed to enable the /discount/ URL feature.
Best Practices
Following these practices helps you create effective discount campaigns and avoid common issues that can frustrate customers or complicate your analytics.
Use memorable discount codes
SAVE20 is better than D8X9K2—customers may type it manually.
Add UTM parameters for tracking
Track which channels drive the most discount redemptions.
Redirect to relevant pages
Send users to products the discount applies to, not just the homepage.
Test before sharing
Open an incognito window and test the link before launching campaigns.
With your discount codes and links configured, you are ready to run promotions that drive traffic and conversions. The FAQ below answers common questions about Shopify discount link behavior.
Try the URL Builder
Use our Shopify Discount template to build discount links interactively.