fostercommerce / advanced-discounts
Build tiered, conditional, and buy-one-get-one discounts from cart rules.
Package info
github.com/FosterCommerce/craft-advanced-discounts
Type:craft-plugin
pkg:composer/fostercommerce/advanced-discounts
Requires
- php: ^8.2
- craftcms/cms: ^5.0.0
- craftcms/commerce: ^5.0.0
- moneyphp/money: ^4.0
Requires (Dev)
- craftcms/phpstan: dev-main
- craftcms/rector: dev-main
- fostercommerce/ecs: dev-main
- fostercommerce/phpstan: dev-main
- fostercommerce/rector: dev-main
- roave/security-advisories: dev-latest
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-11-30 18:15:55 UTC
README
Advanced Discounts
Build tiered, conditional, and buy-one-get-one discounts from cart rules.
Overview
- Build tiers into one discount, each with its own cart rules and reward: 10% off at $100, 15% at $200, 20% at $500.
- Show customers messages in your cart template, with live figures such as how much more to spend for the next tier.
- Run "buy one, get one free" promotions, where buying one product discounts another.
- Require a coupon code, with bulk code generation and a usage limit per code.
- Limit a discount to matching products or variants.
- Start a new discount from a preset: free items, free shipping, or a free order.
- Choose whether Commerce calculates tax before or after discounts, and whether a shipping discount lowers the shipping cost or shows as its own discount line.
How it works
Create discounts under Advanced Discounts -> Discounts. Each time Commerce recalculates a cart, the plugin tests each enabled discount from the top of the list down, and adds order adjustments for each one that matches. Prices stay as they are. Commerce's own discounts still apply, and both can discount the same cart.
Usage
Promotional messages appear where a template calls getMessages():
{% for discountMessage in craft.advancedDiscounts.getMessages(cart) %}
<p>{{ discountMessage }}</p>
{% endfor %}
This prints each message whose rules match the cart, with figures such as {amountRemaining} filled in.
Requirements
- Craft CMS
^5.0 - Craft Commerce
^5.0 - PHP
^8.2
Install
composer require fostercommerce/advanced-discounts ./craft plugin/install advanced-discounts
Documentation
- Getting started, from install to your first discount on a cart
- Discounts, structuring a discount into groups and tiers
- Cart conditions, the rules that decide when a discount applies
- Displaying promotional messages, rendering messages in Twig
- Troubleshooting, why a discount isn't applying
License
Proprietary.
