Last Updated on by Dan S
Originally Published February 28, 2021.
Adding a little extra to your customers’ shopping carts can significantly boost satisfaction and loyalty. If you’re running a Shopify store, one effective promotional tactic is offering a free gift when customers spend a certain amount—say, $25. This strategy not only enhances the customer experience but also encourages higher spending.
In this post, we’ll guide you through the step-by-step process of setting up your Shopify cart to automatically add a free gift when the checkout total exceeds $25 (or any other amount you decide). Whether you’re a coding novice or an experienced developer, these practical tips and tools will help you delight your customers and potentially increase your average order value.
Let’s dive into how you can make shopping on your site even more rewarding.
The approach
Think of how we’re going to accomplish these:
- How would the free product scenario be tackled?
- Add a product to the cart?
Free items can be treated in several ways:
- Including a new item with a price of zero. You may describe the quantity of a free product in this manner.
- Adding a discount to the free item that is required.
- Using Shopify’s native Buy X Get Y automatic discount feature.
- Installing a third-party app from the Shopify App Store that specializes in free gift promotions.
⚠️ Important Update (2025): The Script Editor app and Shopify Scripts mentioned in the code examples below are being deprecated and will stop working on June 30, 2026. Shopify is transitioning to Shopify Functions as the replacement. If you’re implementing a new free gift feature, we recommend using Shopify’s native discount features or dedicated free gift apps instead of Scripts. Existing Script users should plan to migrate before the deprecation deadline.
How to add a free gift to Shopify cart when checkout total is over $25
Method 1: Custom Liquid Snippet (Legacy Approach)
Note: This method requires coding knowledge and may need updates to work with modern Shopify themes.
We’re going to create a new snippet and call it “free-gift-inject.liquid.”
Introducing the variables:
- Overprice free gift: Since Shopify deals in cents, you’ll need to multiply (amount*100) to get the cost.
- Variant ID: To access the variant ID, you can update the variant to pick a product from the list of products.
We’ll submit a JSON request for the current cart objects, and then use AJAX to update the values on the /cart page:
{% assign free_gift_over_price_25 = 2500 %}
{% assign variant_id = '31059890110524' %}%MINIFYHTMLbb5152be2bdca19348291128445b4dd3968a6c47fbf56fa42f2e8a58b5b3828e171033bb9f15d1e89b200526684b6952713234f9bfbc467a15551e7a87fbbf6323%Edit your cart.liquid after the snippet is generated to contain the created Shopify snippet. You can use cart-template.liquid instead of cart.liquid if it’s available.
{% comment %}
In /sections/cart-template.liquid, you will find the contents of the cart.liquid template.
{% endcomment %}
{% section 'cart-template' %}
{% include 'free-gift-inject' %}
Method 2: Using Shopify Script Editor (Shopify Plus Only – Deprecated)
⚠️ Deprecation Notice: The Script Editor app is no longer available for download from the Shopify App Store. On June 30, 2026, Shopify Scripts will be removed and will no longer work. If you currently use Scripts, you should migrate to Shopify Functions or use dedicated free gift apps before this date.
If you currently have Script Editor installed (legacy users only), here’s how it worked:
- Navigate to the app
- Go to Line Items
- Create script and select Blank script
Under code, add the following:
FREEBIE_PRODUCT_ID = 31059890110524 CART_TOTAL_FOR_DISCOUNT_APPLIED = Money.new(cents: 2500) DISCOUNT_MESSAGE = "Get a FREE gift for ordering $25 or more" freebie_in_cart = false cart_price_exceeds_discounted_freebie_amount = false cost_of_freebie = Money.zero # Test if the freebie is in the cart, also get its cost if it is so we can deduct from the cart total Input.cart.line_items.select do |line_item| product = line_item.variant.product if product.id == FREEBIE_PRODUCT_ID freebie_in_cart = true cost_of_freebie = line_item.line_price end end # If the freebie exists in the cart, check the subtotal of the other items to see if the freebie should be discounted if freebie_in_cart cart_subtotal_minus_freebie_cost = Input.cart.subtotal_price - cost_of_freebie if cart_subtotal_minus_freebie_cost >= CART_TOTAL_FOR_DISCOUNT_APPLIED cart_price_exceeds_discounted_freebie_amount = true end end # Only true if the freebie is in the cart was_discount_applied = false if cart_price_exceeds_discounted_freebie_amount Input.cart.line_items.each do |item| if item.variant.product.id == FREEBIE_PRODUCT_ID && was_discount_applied == false if item.quantity > 1 new_line_item = item.split(take: 1) new_line_item.change_line_price(Money.zero, message: DISCOUNT_MESSAGE) Input.cart.line_items << new_line_item next else item.change_line_price(Money.zero, message: DISCOUNT_MESSAGE) end end end end Output.cart = Input.cart
Method 3: Modern Approaches (Recommended for 2025)
Option A: Shopify’s Native Buy X Get Y Discount
The simplest approach uses Shopify’s built-in automatic discount feature. While customers must manually add the free gift to their cart, it’s free and requires no coding:
- From your Shopify admin, go to Discounts
- Click Create discount > Buy X get Y
- Select Automatic discount
- Set your minimum purchase amount (e.g., $25)
- Choose the free gift product
- Set the discount value to Free
Option B: Free Gift Apps
For automatic addition to cart and more advanced features, consider these popular apps from the Shopify App Store:
- BOGOS (Free Gift Bundle Upsell) – Comprehensive solution with 4.9/5 rating, offers auto-add to cart functionality
- EG Auto Add to Cart Free Gift – User-friendly interface with reliable performance
- Gift Box – Simple gift management with clean customer experience
- CartBot: Gift with purchase – Automatically adds products based on cart rules
These apps typically offer free trials and provide features like automatic gift addition, progress bars showing how close customers are to earning gifts, and the ability to create multiple gift tiers.
Why This Matters for Your Store
According to recent ecommerce data, the average order value across all industries reached $144.57 in November 2024, representing an 8.7% annual increase. Setting smart free gift thresholds slightly above your store’s average order value can encourage customers to add more items to their cart, effectively increasing your revenue per transaction.
The key is to choose a threshold and gift that makes sense for your business. Test different amounts and monitor your results to find the sweet spot that maximizes both conversions and profitability.







