Introducing Advanced Discounts for Craft Commerce
By Stephen Callender
· 4 min read
Advanced Discounts is a new discount engine for building tiered, conditional, and buy-one-get-one discounts in Craft Commerce. We’ve been developing it since early 2024 and installing it on our clients’ stores. Now it’s ready for yours.
Why we built it#
Craft Commerce’s built-in discounts do a lot: date ranges, customer groups, categories, spend and quantity thresholds, free shipping, and coupon codes with usage limits. But our clients kept asking for 3 features they don’t have:
- Buy X, Get Y offers, where buying one product discounts another.
- Cart messages that tell the customer how close the next reward is.
- Products matched by a rule, such as a product type or a field value, so a discount can use the data products already have.
With each new request, we’d build each one as a custom feature for that one store.
Then, in December 2023, a publisher sent us a spreadsheet of the 28 coupon types their old store ran: “Buy X and get Y & Z free,” “BOGO 1/2 off,” “$ off series or author.” They wanted to know if Craft Commerce could handle those. On its own, Craft Commerce couldn’t run the buy-one-get-one offers on that list.
That spreadsheet made us decide to build these discounts once, for every store, so merchants don’t have to rely on custom code to run similar campaigns. After all, we build our other Craft plugins, such as Net Terms and Variant Manager, the same way: each one adds a set of features many ecommerce stores need.
One discount with several groups#
Advanced Discounts runs alongside Craft Commerce’s own discounts and is designed around one idea: discount groups.
Promotions are rarely one rule. They’re 10% off at one total and 15% at the next, or a better deal on Friday than on Thursday. We wanted all of that in one discount, to match how marketers think about promotions and to make them easier to manage.
That’s why a discount can have several groups, and each group has its own triggers (or conditions), rewards (or actions), and messages. A group’s triggers can be dates, what’s in the cart, the order’s totals or item count, or who the customer is. Its reward can be a flat amount or a percentage off the order, chosen items, or shipping.
Take a sale with 3 tiers: 10% off at $100, 15% at $200, and 20% at $500. In Advanced Discounts, that’s one discount with 3 groups, one per tier. A store can also limit the sale to matching products, such as one product type. Only the matching products count toward the tiers and get the discount, and the rest of the cart can get other discounts.

A store can change the deal by date, too. A Black Friday sale can get better as the week goes on: 10% off on Thanksgiving, 15% on Black Friday, and 20% from Saturday through Cyber Monday. Each offer is a group with its own date range.
A bulk discount works the same way: 10% off 25 or more of a product and 15% off 50 or more, with a group for each quantity.
Buy X, Get Y#
Buy X, Get Y has been requested on Craft Commerce’s GitHub since 2017. A free pair of socks with every tee sounds simple until there are 3 tees and 2 pairs of socks in the cart. A Buy X, Get Y discount works out how many rewards the cart has earned, so both pairs are free. When the cart has more pairs of socks than it has earned, the plugin makes the cheapest pairs free.
Buy X, Get Y enables offers like these:
- Buy a Classic Tee, get Classic Socks free.
- Buy 2 sample packs, get a third free.
- Buy a jacket and a scarf, get a hat half off.
The plugin’s messages work here too, so a cart with 2 sample packs can say “Add a third sample pack for free.”

Messages with live figures#
Tiered promotions work best when shoppers know where they stand. In the 3-tier sale, a customer with $170 in the cart is $30 from 15% off. Each group can show a message, with placeholders for the amounts. That $170 cart can tell the shopper: “Spend another $30 to get 15% off.” When the customer adds a $40 item, the message changes to “Spend another $290 to get 20% off.”

Use your existing product data#
Craft Commerce’s built-in discounts match products picked by hand, or products related to a category or entry. A store that marks its products another way, such as a product type or a “part” switch, has to add a relation field only for discounts, or keep a hand-picked list up to date.
In Advanced Discounts, a discount can match products by the data they already have, such as product type, SKU, price, or a field value. A discount can also name a whole product, and every variant counts, including new sizes and colors.
…and more#
- Coupon codes work on every kind of discount, including Buy X, Get Y, and a store can generate them in bulk, each with its own usage limit.
- A new discount can start from a preset: free items, free shipping, or a free order.
- A discount can take an amount or a percentage off shipping, shown as a lower shipping charge or as its own discount line.
- A store can charge tax on the full price or on the discounted price.
- Discount names and messages can differ for each site.
- Each discount on an order records its reward and coupon code, so invoices and reports can show both.
Getting started#
Advanced Discounts is $57 and runs on Craft 5 and Craft Commerce 5. Install it from the Plugin Store or with Composer:
composer require fostercommerce/advanced-discounts
./craft plugin/install advanced-discountsShowing the messages in your cart takes one loop in the template:
{% for discountMessage in craft.advancedDiscounts.getMessages(cart) %}
<p>{{ discountMessage }}</p>
{% endfor %}The getting started guide walks from install to a discount on a cart. The recipes cover a tiered sale, a site-wide coupon, a timed product discount, and Buy X, Get Y.
If you try it, I’d love to hear which offers you run with it.