In a recent Business Bloomer Club Slack thread, a familiar WooCommerce frustration came up: why isn’t there a simple $cart->add_discount() function, like there is for $cart->add_fee()?
Store owners and developers often want to apply a quick, programmatic discount without needing to set up a coupon. But currently, WooCommerce doesn’t offer a built-in method for this.
In our Slack chat, we explored common workarounds, drawbacks of using negative fees, and how a built-in method could solve many headaches.
So why does this limitation exist—and what can we do about it?
Why Coupons Are Overkill for Developers
WooCommerce’s default approach to discounts is via the coupon system. While powerful, it’s not ideal for quick, conditional adjustments.
Creating a coupon programmatically, applying it, and removing it after the order feels unnecessarily heavy for something as simple as knocking $20 off the cart total.
Why add_fee() Isn’t a Real Solution
Some developers try to work around this by using $cart->add_fee( 'Manual Discount', -20 )
But this is where things get messy. Negative fees cause issues with:
- Tax calculations: WooCommerce gets confused when applying VAT to a negative line item.
- Accounting systems: E-invoicing tools often break or throw errors.
- Reporting: Discounts aren’t always logged consistently.
That’s why many in the WooCommerce dev space avoid this method altogether for discounts.
A Simpler Solution: $cart->add_discount()
Adding an official $cart->add_discount( 'Label', 20, true ) function would solve this cleanly. The parameters could mirror add_fee, with optional tax settings, making it intuitive for developers. The discount would show up clearly at checkout, on invoices, and in reports—without requiring a coupon object.
This would allow for:
- Payment method-based discounts
- Cart total threshold adjustments
- Custom user role promos
- Developer sanity
Temporary Workarounds
Until WooCommerce adds such a method, you’re left with two options:
- Create and apply a virtual coupon on the fly, then remove it before order completion (extra logic required).
- Use a custom hook at checkout to modify the total, but this can interfere with totals, taxes, and third-party integrations.
Conclusion
WooCommerce developers deserve better than hacking around with negative fees or coupons.
A native $cart->add_discount() method would go a long way in making programmatic discounts easier, more accurate, and more professional. Until then, we’ll keep patching and hoping.








