Checkout helpers guide

How to add a discount code field to your Shopify cart

Quick answer

To add a discount code field to your Shopify cart, turn on the Discount code block in Nexora's Cart editor (Extra group). Shoppers open the discount button in the drawer, enter a code and click Apply; applied codes are listed and can be removed. If a new code can't be combined with one already applied, the drawer shows your Combinability warning message.

Updated 6 min read Install free

Why a discount field in the cart helps

Shoppers with a code from an email, an influencer or a welcome popup want to see the discounted total before they commit. If the only place to enter it is checkout, some will hesitate, unsure whether the code works or how much they'll save.

Letting them apply it in the cart answers that question early. They see the discount and the new total in the drawer, and they arrive at checkout with the code already applied.

There's a trade-off worth knowing. A visible code box can send shoppers without a code off to search for one. Many stores accept that because their codes come from their own emails and social posts. If it worries you, give the button a low-key name such as Have a code? so it's there for those who need it without drawing attention.

  • Good fit: stores that send codes by email, run influencer codes or give welcome codes.
  • Less important: stores that mostly use automatic discounts, which apply without a code.

Your options on Shopify

Shopify checkout always has a discount code field, so codes work without any app. Shopify also supports shareable discount links that apply a code when the shopper opens the link. Whether there's a code field in the cart itself depends on your theme; many themes don't include one. You create the codes themselves in Shopify Discounts.

Where codes can be enteredAvailable
Shopify checkoutAlways
Shareable discount linkYes, from the discount's page in Shopify
Theme cartDepends on the theme
Nexora cart drawerYes, with the Discount code block

Step by step: add the discount field

  1. Create your codes in Shopify

    Make sure the codes you share exist in Shopify Discounts and are active. The drawer applies Shopify's own codes; it doesn't create them.

  2. Turn on the block

    In the Cart editor, switch on Discount code in Extra group. It appears as a button in the drawer's toolbar.

  3. Name the button

    Set Extra item text (default Discount). This is the toolbar button shoppers click.

  4. Edit the panel text

    Edit Label field, Placeholder, Button apply, Applied text, Error message and Button close to match your store's voice.

  5. Write the combination message

    Edit Combinability warning. {codes} and {newCode} are filled in automatically, for example {codes} cannot combine with {newCode} and was removed.

  6. Save and test

    Click Save. Open the drawer on your store, apply a real code and check the discount line in the totals.

Toolbar buttons such as Discount sit under the cart items

Settings reference

SettingDefault text
Extra item textDiscount
Label fieldAdd a discount code
PlaceholderEnter your discount code
Button applyApply
Applied textApplied
Error messageEnter a valid discount code
Combinability warning{codes} cannot combine with {newCode} and was removed.
Button closeClose

In the Cart buttons block, Label discount sets the name of the discount line in the totals.

What shoppers see after applying a code

Discount in ShopifyWhere the saving shows in the drawer
Amount or percentage off the whole orderA line in the totals, named by Label discount followed by the code, for example Discount: SUMMER15
Amount or percentage off specific products or collectionsUnder each matching item, with the discount's name
Any applied codeA tag in the discount panel with a button to remove it

After a successful apply, the Button apply label changes to your Applied text for about two seconds, then switches back so another code can be entered. When a shopper removes one code, any other applied codes stay on the cart.

Example: a welcome code and a seasonal code

A store sends new subscribers WELCOME10 and runs SUMMER15 for everyone. In Shopify, the two codes are set not to combine with each other.

  • Extra item text: Have a code?
  • Placeholder: e.g. WELCOME10
  • Error message: That code isn't valid or has expired
  • Combinability warning: {newCode} can't be used with {codes}, so the earlier code was removed.

A shopper who applies WELCOME10 and then SUMMER15 sees the warning, so they understand why the first code disappeared instead of thinking something broke.

Watch checkout clicks and completed orders on the Analytics funnel

Second example: a code for one collection

The same store runs SOCKS20, 20% off products in its Socks collection, set up in Shopify as an amount off products discount.

  • Cart with socks and a jacket: the 20% shows under the socks line only, and the estimated total drops by that amount. The jacket is unchanged.
  • Cart with only a jacket: the code doesn't apply to anything in the cart, so Shopify doesn't apply it and the drawer shows the Error message.
  • Error message: That code isn't valid for the items in your cart. works for this case and for mistyped or expired codes, because the same message is used for all of them.

Tips and common mistakes

  • Code shows as invalid: check it's active in Shopify, hasn't reached its usage limit, and that the cart meets its minimum requirements.
  • Codes replacing each other: that's Shopify's combination settings at work. Review which discounts can combine on each discount's page.
  • Writing the error message: keep it helpful, for example mention that codes may have a minimum spend.
  • Too many toolbar buttons: the Extra group can hold several blocks; keep only the ones your shoppers use.
  • Translations: translate the panel text on the Translations page.

Automatic discounts and codes together

Automatic discounts in Shopify apply without a code, and whether they combine with codes depends on each discount's combination settings. If an automatic discount disappears after a shopper enters a code, review the combinations on both discounts in Shopify.

Running a free shipping threshold? A code can lower the total below it, so test codes alongside your cart progress bar.

Frequently asked questions

Do I create discount codes in the app?

No. Create them in Shopify Discounts. The drawer lets shoppers apply those codes before checkout.

Can shoppers apply more than one code?

Yes, if the codes are allowed to combine in Shopify. Applied codes are listed and can be removed.

What happens if two codes can't combine?

The existing code is removed and the drawer shows your Combinability warning message.

Is the code still applied at checkout?

Yes. Codes applied in the drawer are applied to the cart, so shoppers arrive at checkout with them.

Can I change the button name?

Yes, with Extra item text.

Why doesn't a product discount show in the totals?

Discounts on specific products show under those items in the cart. The totals line, named by Label discount, shows discounts on the whole order.

Why does a real code show the error message?

If the cart doesn't meet the code's conditions, such as a minimum purchase or eligible products, Shopify doesn't apply it and the drawer shows your Error message.

Keep reading

Related guides

Try Nexora Cart Upsell Cart Drawer free

Every feature in these guides is included — free, on any Shopify plan.