Skip to main content

How to Add Discount Codes to a Cart

Let customers apply and view discount codes right from the cart.

The Discount Codes block adds a discount input form to your cart and shows customers which discounts are currently applied. It's the fastest way to let shoppers redeem codes before reaching checkout.

🛠️ How to Set It Up

  1. Click Add Block, then choose Discount Codes. Then click through to the block settings

  2. Decide how the block should appear on the cart:

    • Tick the checkbox "Use button to show/hide block" to show or hide the Discount Block behind a button. With this checked, you can set the button's text and styling. When a customer clicks it, the Discount Code input form and any applied discount codes are revealed.

    • Leave it unchecked to have the block always visible on the cart.

  3. Style how applied discount codes are displayed. You can style the discount code text using the Wysiwyg, plus their background color and border color.

  4. Set whether the input form is shown or hidden by ticking the Show form checkbox:

    • Hide it if you only want to display which discount codes are already applied to the cart.

    • Show it if you want customers to be able to enter their own discount codes.

  5. If the form is shown, fill out the remaining fields:

    • Input placeholder

    • Apply button text

    • Apply button style

    • The button and inputs styles can be set globally in app's Branding section

  6. Set up your error messages and their styling:

    • Click into the input and click Apply in the cart preview for an example error.

    • Style the error text using the built-in WYSIWYG editor.

Shopify doesn't return default error messages when a discount code fails to be applied to the cart, so you'll need to set these manually. There are two error types:

  • Conflicting Discount Error — shown when the discount code can't be added (e.g., it conflicts with another discount).

  • Invalid Discount Error — shown when the discount code doesn't exist or doesn't work.

Shipping discount codes and gift cards can not be applied in the cart — customers need to enter those at checkout instead.

Did this answer your question?