Imagine this: A shopper is filling up their cart on your WooCommerce store. They reach a certain amount, and then—surprise!—a free gift automatically appears in their cart. No confusing codes. No extra clicks. Just a sweet reward. Sounds awesome, right?
Well, you’re in luck. Today, we’ll learn how to add a free gift to a customer’s cart automatically based on their cart total. It’s easy if you follow this simple guide.
🎁 Why Offer a Free Gift?
- Boost Sales: Shoppers will add more to their carts just to get that freebie.
- Delight Customers: Free stuff makes people happy. Happy people come back.
- Build Loyalty: Small gestures go a long way in creating brand fans.
Now, let’s get to the fun part. There’s no need for a fancy plugin (unless you want one—we’ll cover that too). We’re starting with a simple way using code.
🛠️ The Manual Method (Using Functions.php)
This method works great if you’re comfortable adding custom code to your WordPress theme. You’ll need to:
- Have access to your theme’s functions.php file
- Know the product ID of your free gift
- Set the minimum cart total that qualifies for the gift
Let’s jump right in. Here’s the code you’ll add to functions.php of your active theme:
add_action('woocommerce_before_calculate_totals', 'add_free_gift_based_on_total');
function add_free_gift_based_on_total($cart) {
if (is_admin() && !defined('DOING_AJAX')) return;
$free_gift_id = 123; // Replace with your free product ID
$min_total = 100; // Set your threshold amount
$has_gift = false;
foreach ($cart->get_cart() as $cart_item_key => $cart_item) {
if ($cart_item['product_id'] == $free_gift_id) {
$has_gift = true;
break;
}
}
if ($cart->subtotal >= $min_total && !$has_gift) {
$cart->add_to_cart($free_gift_id);
}
if ($cart->subtotal < $min_total && $has_gift) {
foreach ($cart->get_cart() as $cart_item_key => $cart_item) {
if ($cart_item['product_id'] == $free_gift_id) {
$cart->remove_cart_item($cart_item_key);
}
}
}
}
What this does:
- Automatically adds the gift if the cart total meets or exceeds the limit
- Removes the gift if the total drops below the limit again
Tip: Use a coupon system if you also want to limit how often someone can get a gift.

🧩 Want a Simpler Way? Use a Plugin!
If typing code gives you nightmares, don’t worry. There are plugins that can handle this for you. No coding needed!
✅ Recommended Plugins:
- WooCommerce Auto Added Coupons – Free and simple. Add a gift product via a “coupon” that activates at a cart subtotal.
- Advanced Free Gift For WooCommerce – More flexibility and lots of configuration options
- YITH WooCommerce Gift Products – Stylish interface. Great if you want customer to choose the gift.
Using a plugin is as simple as:
- Install and activate your chosen plugin
- Set a rule like “Gift X is added when cart is over $100”
- Save settings, and you’re done!
Everything happens behind the scenes, automatically.
💡 Pro Tips to Maximize This Feature
- Name Your Gift Product Clearly – Try “Free Surprise Gift 🎁” so shoppers notice it
- Use a Product with $0 Price – You don’t want to charge accidentally!
- Track Conversions – Use Google Analytics to see if your sales increase
- Try Gift Variations – Switch up the item monthly to keep things exciting

🚨 Common Mistakes to Avoid
- Using a Gift That’s Out of Stock – Always make sure you have inventory
- Forgetting to Exclude Gift from Coupons – Customers shouldn’t discount the gift
- Adding Tax or Shipping to the Gift – Keep it truly free
🧠 A Quick Recap
Add a free product to the customer’s cart when they spend a certain amount. This can:
- 💰 Boost order value
- 😊 Create customer delight
- 📈 Increase repeat business
You can do it with a sneaky bit of code (if you’re bold). Or keep it simple with a plugin (if you prefer easy).
📦 Final Thoughts
Store owners are always looking for an edge. A free gift might seem small—but it works wonders. You’ll find that sales increase. Customers grin. And repeat orders skyrocket.
So start today. Pick your favorite freebie. Set a cart total. Add the code or install a plugin. Then watch the magic happen.
Trust us. Your customers will love the surprise—and so will your bottom line.
Now, go make someone’s day… with the power of free. 🎉