Last updated: November 19, 2026. Steps checked against Shopify’s admin, the Dawn and Horizon themes, and Shopify’s Cart AJAX API documentation on November 18, 2026.
Quick answer: Shopify always shows a discount code field at checkout, but many themes, including Dawn, have none in the cart. To add one, first check whether your theme already has it (Horizon themes do). If not, send shoppers a shareable discount link, paste a small code box that uses Shopify’s cart API (/cart/update.js, supported since May 2025), or use a cart drawer app with a built-in code field.
Key takeaways:
- No app is needed: a discount link or a 30-line snippet works on any theme.
- A code in the cart shows shoppers their real total before checkout.
- Hide the box behind a “Have a code?” link so shoppers don’t leave to hunt for coupons.
In this guide
- Why add a code box to the cart
- The 4 methods compared
- Method 1: Check your theme
- Method 2: Shareable discount link
- Method 3: Add a code box with code
- Method 4: Use a cart drawer app
- Stacking rules and limits
- Why a code doesn’t apply
- FAQ
Why Add a Discount Code Box to the Shopify Cart?
Because shoppers want to see their final price before they commit to checkout. Without a code box in the cart, a shopper with a code sees the full price, has to start checkout to apply it, and only then sees what they’ll pay. That extra step causes doubt and drop-offs, especially on mobile.
- Real totals earlier: the discount and new subtotal show in the cart.
- Better free shipping and upsell math: shoppers see how close they are to a free shipping threshold after the discount.
- Fewer support questions: no more “where do I enter my code?” emails.
The one risk: a big empty code field tells shoppers without a code that they’re missing a deal, and some leave to search for one. Show it as a small “Have a discount code?” link that opens the field, and announce your real offers on the page so nobody has to hunt.
What Are the Ways to Add a Discount Code to the Shopify Cart?
Four methods, from no work to a few minutes of theme editing.
| Method | Shopper types a code? | Skill needed | Cost | Best for |
|---|---|---|---|---|
| 1. Theme setting | Yes | None | Free | Horizon and newer themes |
| 2. Discount link | No, the link applies it | None | Free | Emails, ads, influencers |
| 3. Code snippet | Yes | Copy and paste | Free | Dawn and other free themes |
| 4. Cart drawer app | Yes | None | Usually a monthly fee | Stores that also want upsells and a free shipping bar |
Method 1: Does Your Theme Already Have a Cart Discount Field?
Check this first, because newer themes include one. Shopify’s Horizon themes show a discount code field in the cart summary, and many paid themes have a setting for it.
- In Shopify admin, go to Online Store > Themes and click Customize.
- Open the Cart page from the page menu at the top, and open your cart drawer by adding a product.
- Click the cart section or the subtotal block and look for a setting such as Show discount code field or a Discount block.
- Search your theme’s help docs for “discount” if you can’t find it.
Dawn and older free themes such as Refresh, Sense and Craft don’t have this setting, so use Method 2, 3 or 4.
Method 2: How Do Shareable Discount Links Work?
A discount link applies the code automatically when the shopper clicks it, so they never type anything. The code then shows in the cart and at checkout.
- Go to Discounts in Shopify admin and open your discount code.
- Click Promote, then Get a shareable link.
- Choose where the link lands, such as your home page, a product or a collection, and copy it.
You can also build the link yourself: https://yourstore.com/discount/CODE, or add ?redirect=/collections/sale to send shoppers to a page after the code applies.
Use it for: welcome emails, abandoned cart emails, ads, influencer links and QR codes. Limit: it only helps shoppers who arrive through the link, so you still need Method 1, 3 or 4 for people who received a code another way.
Method 3: How Do You Add a Discount Code Box With Code?
Since May 2025, Shopify’s cart API accepts discount codes, so a small snippet can apply a code in the cart on any theme. These steps are for Dawn; other themes use similar file names.
Before you start: click the three dots next to your live theme and choose Duplicate. Edit the copy, test it, then publish it.
Step 1: Create the snippet
On your duplicate theme, click the three dots and choose Edit code. In the snippets folder, click Add a new snippet, name it cart-discount, and paste this code:
<details class='cart-discount'>
<summary>Have a discount code?</summary>
<div class='cart-discount__row'>
<input id='CartDiscountInput' type='text' placeholder='Discount code' autocomplete='off'>
<button type='button' id='CartDiscountApply' class='button button--secondary'>Apply</button>
</div>
<p id='CartDiscountMessage' role='status' aria-live='polite'></p>
</details>
<style>
.cart-discount { margin: 12px 0; }
.cart-discount summary { cursor: pointer; text-decoration: underline; }
.cart-discount__row { display: flex; gap: 8px; margin-top: 8px; }
.cart-discount__row input { flex: 1; min-height: 44px; padding: 0 12px; }
</style>
<script>
document.addEventListener('click', function (event) {
if (!event.target.closest('#CartDiscountApply')) return;
var input = document.getElementById('CartDiscountInput');
var message = document.getElementById('CartDiscountMessage');
var code = input.value.trim();
if (!code) { message.textContent = 'Please enter a code.'; return; }
message.textContent = 'Applying...';
fetch(window.Shopify.routes.root + 'cart/update.js', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ discount: code })
})
.then(function (response) { return response.json(); })
.then(function () { window.location.reload(); })
.catch(function () { message.textContent = 'Something went wrong. Please try again.'; });
});
</script>The code sends the shopper’s code to Shopify’s /cart/update.js endpoint with the discount parameter, then reloads the page so your theme shows the discount and new total. If the code isn’t valid for the cart, Shopify doesn’t apply it and the total stays the same.
Step 2: Add it to the cart page
In the sections folder, open main-cart-footer.liquid. Find <div class='cart__blocks'> (it uses double quotes in the file) and paste this line just below it:
{% render 'cart-discount' %}Step 3: Add it to the cart drawer
In the snippets folder, open cart-drawer.liquid. Find the drawer__footer div and paste the same render line just inside it. If your store uses only the cart page, skip this step.
Step 4: Test it
- Create a test code under Discounts, such as 10% off.
- Preview your duplicate theme, add a product and enter the code in the cart.
- Check that the discount and new total show, then go to checkout and check it’s still applied.
- Try a wrong code and a code below its minimum spend, and check the total doesn’t change.
- Test on your phone, then publish the theme.
Good to know: sending one code replaces any code already in the cart. To keep several codes, send them together separated by commas, for example CODE1,CODE2. Sending an empty value removes all codes. Theme updates can overwrite edited files, so note your changes and check the cart after updating.
Method 4: Should You Use a Cart Drawer App Instead?
Use an app if you don’t want to edit code, or if you also want a better cart. Many cart drawer apps include a discount code field alongside a free shipping bar, upsells, gift options and a terms checkbox, all set up without code.
When choosing one, check:
- It works with your theme’s cart drawer and the cart page.
- It shows clear messages when a code is applied or can’t be used.
- It respects Shopify’s combination rules instead of applying its own discounts.
- It doesn’t slow your store: test page speed before and after installing.
- The price fits: a code field alone isn’t worth a big monthly fee, so only pay if you’ll use the other features.
Our guide to the Shopify cart drawer covers what else to add to it.
How Many Discount Codes Can a Shopify Cart Use?
Shopify lets an order combine up to 5 product or order discount codes and 1 shipping discount code, but only if each discount is set to combine.
- To let codes stack, open each discount under Discounts, tick the discount types it can combine with under Combinations, and save.
- Automatic discounts, such as buy X get Y or quantity breaks, apply on their own. A code only stacks with them if both are set to combine.
- When two discounts can’t combine, Shopify keeps the one that gives the bigger saving.
Why Won’t a Discount Code Apply in the Cart?
| Problem | What to check |
|---|---|
| Code accepted but no discount | Minimum spend or quantity, products or collections it applies to |
| Works for you, not for customers | Customer eligibility, one use per customer, total usage limit |
| Second code removes the first | Combinations settings on both discounts |
| Code fails in some countries | Whether the discount is limited to certain Markets or currencies |
| Code expired | Start and end dates, and your store’s time zone |
| Shipping code shows no saving in cart | Free shipping discounts apply once the shipping method is chosen at checkout |
What Are the Best Practices for a Cart Discount Field?
- Keep it small: a “Have a code?” link, not a big empty box.
- Show the saving clearly: the discount line and new total should be easy to see.
- Write helpful errors: tell shoppers why a code didn’t work, such as a minimum spend.
- Make it easy on mobile: an input and button at least 44 pixels tall.
- Don’t make shoppers hunt: show your current offer in an announcement bar, or apply it automatically with an automatic discount.
- Test before big sales: try every code you plan to use for BFCM in the cart and at checkout.
The Bottom Line
Shopify always accepts discount codes at checkout, but adding a code box to the cart shows shoppers their real total sooner. Check your theme first, use shareable discount links for emails and ads, paste the snippet above if your theme has no field, or use a cart drawer app if you also want a free shipping bar and upsells. Keep the field small, set your combination rules, and test every code before a sale.
Frequently Asked Questions
Does Shopify have a discount code field in the cart?
Shopify always shows a discount field at checkout. In the cart it depends on your theme: Horizon themes include one, while Dawn and older free themes don’t.
Can I apply a discount code in the Shopify cart without an app?
Yes. Use a shareable discount link, or add a code box that sends the code to Shopify’s /cart/update.js endpoint with the discount parameter, as shown in Method 3.
How do I make a Shopify discount code apply automatically?
Create an automatic discount instead of a code, or share a discount link such as yourstore.com/discount/CODE, which applies the code when clicked.
Can customers use more than one discount code?
Yes, up to 5 product or order codes and 1 shipping code per order, but only if each discount is set to combine with the others.
Will a cart discount code box reduce my profit?
It can if shoppers leave to hunt for codes. Keep the field small and only share codes you’re happy for anyone to use.
Do I need Shopify Plus to add a discount field to the cart?
No. Theme settings, discount links, the cart API and cart apps all work on every Shopify plan.
Related Reading
- How to Create Discounts on Shopify
- Best Shopify Discount Apps
- Shopify Cart Drawer: Upsells and a Free Shipping Bar
- How to Set Up BOGO on Shopify
- 34 Black Friday Promotion Ideas for Shopify
Update Log
November 19, 2026: First published, with steps checked against Shopify’s admin, the Dawn and Horizon themes, and the Cart AJAX API documentation on November 18, 2026.
