Skip to main content

How to Apply Discount Codes Automatically Using Cart Permalinks

Learn how to create direct links that automatically apply discount codes to the cart - and optionally add products too. Perfect for notification feeds, email campaigns, and promotional popups.

Lisa Fockens avatar
Written by Lisa Fockens
Updated this week

Overview

Cart permalinks allow you to create URLs that automatically apply discount codes when clicked. You can also optionally add specific products to the cart at the same time.

Common use cases:

  • Apply exclusive discount codes from promotional campaigns

  • Combine discount application with product recommendations

  • Create "unlock your reward" experiences with automatic code application

  • Streamline the checkout process for time-sensitive offers

Shopify

Apply Discount Code Only

To apply a discount code without adding any products:

https://yourstore.com/discount/DISCOUNT_CODE

This redirects to the homepage with the discount code applied to the cart.

Example:

https://yourstore.com/discount/WELCOME10

Apply Discount Code + Add Product

To add a product AND apply a discount code while preserving existing cart items:

https://yourstore.com/cart/add?id=VARIANT_ID&discount=DISCOUNT_CODE

Example:

https://yourstore.com/cart/add?id=47195411054926&discount=FREEGIFT

Finding Your Variant ID

Only needed if you want to add products to the cart:

  1. Go to Products in your Shopify admin

  2. Select the product you want to link to

  3. Click on a variant (or the product itself if there's only one variant)

  4. Look at the URL in your browser - the variant ID is the number at the end

  5. Example: admin.shopify.com/store/yourstore/products/123456789/variants/47195411054926

    • Variant ID = 47195411054926

Optional Parameters

Add multiple quantities:

https://yourstore.com/cart/add?id=VARIANT_ID&quantity=2&discount=CODE

Add multiple products:

https://yourstore.com/cart/add?id=VARIANT_ID_1&id=VARIANT_ID_2&discount=CODE

Example Use Cases

Exclusive VIP discount:

https://yourstore.com/discount/VIP20

Free gift with purchase:

https://yourstore.com/cart/add?id=47195411054926&discount=FREEGIFT

Flash sale:

https://yourstore.com/discount/FLASH50

Important Notes

  • Use /cart/add (not /cart/) to preserve existing cart items when adding products

  • The discount code must be active in your Shopify admin

  • If the discount has minimum purchase requirements, ensure the cart meets them

  • Test your links in an incognito window to verify they work correctly

Common Mistakes to Avoid

Wrong: https://yourstore.com/cart/add?47195411054926&discount=CODE

  • Missing the id= parameter

Wrong: https://yourstore.com/cart/47195411054926:1?discount=CODE

  • Using /cart/ instead of /cart/add will clear existing cart items

Correct (code only): https://yourstore.com/discount/CODE

Correct (code + product): https://yourstore.com/cart/add?id=VARIANT_ID&discount=CODE

BigCommerce

Apply Discount Code + Add Product

BigCommerce supports automatic coupon application:

https://yourstore.com/cart.php?action=add&product_id=PRODUCT_ID&coupon_code=DISCOUNT

Example:

https://yourstore.com/cart.php?action=add&product_id=456&coupon_code=WELCOME10

Best Practices

1. Test Before Launching

Always test your permalink in an incognito/private browser window to ensure:

  • The discount code applies successfully

  • Products are added correctly (if applicable)

  • Existing cart items are preserved (if desired)

  • The discount requirements are met

2. Strategic Campaign Setup

For progressive discount campaigns (e.g., "Free gift at $50"), split into two campaigns:

Campaign 1 - Teaser (cart value: $30-$49)

  • Message: "Add $X more to unlock your free gift!"

  • Button: Regular link to collection/product page

Campaign 2 - Reward (cart value: $50+)

  • Message: "Congratulations! Here's your free gift!"

  • Button: Uses permalink to apply code + add gift product

This creates a smooth, gamified experience.

3. Use in Wisepops

In your Wisepops notification or popup:

  1. Add a button element

  2. Set the button action to "Go to URL"

  3. Paste your complete permalink

  4. The discount will be applied (and product added if included) when clicked

4. Clear Communication

Make sure your messaging clearly explains what will happen:

  • ✅ "Apply your discount"

  • ✅ "Claim your code"

  • ✅ "Get your 20% off"

  • ✅ "Add to cart + apply code" (if adding products)

  • ❌ Don't just say "Click here" without context

Troubleshooting

The discount code isn't applying

Check:

  • Is the discount code active in your store admin?

  • Does the cart meet minimum purchase requirements?

  • Is the code spelled correctly (case-sensitive)?

  • Are there usage limits that have been reached?

The product isn't being added

Check:

  • Is the variant ID correct?

  • Is the product in stock?

  • Is the product visible/published?

  • Try the URL in an incognito window

Existing cart items are being removed

Issue: You're using /cart/ instead of /cart/add on Shopify

Solution: Change to /cart/add format to preserve cart contents

Need Help?

If you're still having trouble setting up cart permalinks, contact our support team with:

  • Your store platform (Shopify, WooCommerce, etc.)

  • The permalink you're trying to use

  • A screenshot of the error or unexpected behavior

We're here to help!

Did this answer your question?