How to Add Free Gift via Discount Code
You can add a free gift using a discount code at checkout. This is the same Auto Add to Cart feature as a free gift with purchase, except the gift is tied to a code instead of applying automatically.
This is different from automatic Auto Add to Cart / Free Gift With Purchase (https://regiostech.crisp.help/en/article/auto-add-to-cartfree-gift-with-purchase-1yd9hs0/). Automatic offers add the gift in the Online Store when the cart qualifies. Code offers add the gift when the customer applies the code at checkout.
Requirements
- Shopify Plus. Discount codes add the gift during checkout, which needs a Checkout UI extension. Checkout app blocks are only available on Shopify Plus due to limitations in Shopify outside our control.
- This option may be early access. If you are on Shopify Plus and do not see "Discount code" when creating an Auto Add to Cart offer, message us and ask to enable free gifts with a discount code for your store.
Setup
- Click "Create discount," then click "Auto add to cart."

- Choose "Discount code" (not Automatic), then enter the code customers will type at checkout.

- Build your offer in the advanced logic builder (https://regiostech.crisp.help/en/article/about-the-advanced-settings-page-1xxaj2u/). Use "Add to cart" steps for the gift, not "Apply discount" steps.
- Add the "Checkout auto add to cart" app block to your published checkout:

a. Open Settings > Checkout in Shopify admin, then click "Customize/edit" on your published checkout.
b. Click "Add app block," then select "Checkout auto add to cart."
c. Click "Save." Shopify only applies the block to the checkout you publish, so make sure you save.
- Enable the "Add to Cart Embed" on your Online Store theme. If a customer removes the gift, for example, after going back to the cart page, this embed records the removal so checkout does not add it again.
Until the checkout app block is added, customers who enter the code will not receive the gift.
How it works
- The customer applies your discount code at checkout.
- The "Checkout auto add to cart" app block adds the gift line to the cart, and a Shopify Functions discount makes that gift free when the logic qualifies.
- If the customer removes the gift, we remember that and do not add it again, including if they return to checkout with the same code still applied.
- If they remove the code, the gift is removed with it.
If the customer removes the gift
By default, a gift the customer removes stays removed. That is intentional.
The "Add to Cart Embed" is required for this to work across the Online Store cart and checkout. Without it, a gift added at checkout can come back after the customer removes it on the cart page.
To allow the gift to come back after a manual removal, enable "Re-add items after manual removal" on the Add to Cart Embed in the Theme Editor. See the Auto Add to Cart FAQ (https://regiostech.crisp.help/en/article/auto-add-to-cart-faq-1r18790/).
Limitations
- Shopify Plus is required.
- It does not work in the POS.
- It does not work in manual orders.
- Draft orders are not supported. Shopify does not allow products to be added to a draft order checkout, so the gift is not added.
- Headless storefronts should be supported if they’re using the Shopify checkout.
- Gift products must be published and available, either in stock or set to keep selling when out of stock.
Shopify Functions still apply these limits to the discount that makes the gift free:
- The subtotal is calculated before other discounts are applied. See [Why can't I base a discount on the subtotal after other discounts?](https://regiostech.crisp.help/en/article/why-cant-i-base-a-discount-on-the-subtotal-after-other-discounts-2bvcgi/)
- Subtotal calculations are based on the price, not the compare at price.
More information
- Auto Add to Cart / Free Gift With Purchase, for automatic offers: https://regiostech.crisp.help/en/article/auto-add-to-cartfree-gift-with-purchase-1yd9hs0/
- Auto Add to Cart FAQ: https://regiostech.crisp.help/en/article/auto-add-to-cart-faq-1r18790/
- Troubleshooting Auto Add to Cart: https://regiostech.crisp.help/en/article/troubleshooting-auto-add-to-cart-w3pxxl/
Your Feedback Matters
Your review helps keep this small business running. Please leave one on the Shopify App Store.
Updated on: 03/10/2026
Thank you!