Skip to content

Commerce Foundations: the B2B ecommerce platform for manufacturers and distributors. See what it includes

Craft CMS plugins

Advanced Discounts

Build tiered, conditional, and buy-one-get-one discounts from cart rules.

Getting started

Build tiered, conditional, and buy-one-get-one discounts from cart rules.

This page walks you from composer require to a discount applied to a cart. By the end, you know how a discount, its groups, and their conditions and actions fit together.

Requirements#

  • Craft CMS ^5.0
  • Craft Commerce ^5.0
  • PHP ^8.2

1. Install#

composer require fostercommerce/advanced-discounts
./craft plugin/install advanced-discounts

With DDEV:

ddev composer require fostercommerce/advanced-discounts -w && ddev craft plugin/install advanced-discounts

The control panel sidebar now shows an Advanced Discounts item.

2. Configure#

Go to Settings -> Plugins -> Advanced Discounts.

Tax Basis and Shipping Discounts keep their defaults for this walkthrough. For what each controls, see the configuration reference.

3. Create a discount#

Go to Advanced Discounts -> Discounts and click New discount.

  1. Enter “Spend $100, save 10%” as the Name.
  2. Leave Type on Advanced.
  3. In the first group, enter “10% off” as the Discount Name.
  4. Under Cart Conditions, click Add a cart condition and choose Order. Set its Item Subtotal rule to is greater than or equals 100.
  5. Under Cart Actions, click Add a cart action and choose Line Items. Choose Discount a percentage and enter 10.
  6. Click Save discount.

The discount now heads the list on Advanced Discounts -> Discounts.

4. Check the cart#

Add $100 or more of promotable products to a cart on your storefront. Each line now has a discount adjustment named “10% off”. Below $100, the cart has no adjustment from the plugin.

If the adjustment is missing, see troubleshooting.

Where to go next#

  • Discounts, structuring a discount into groups and tiers.
  • Cart conditions, every rule a group can test.
  • Messages, telling customers how close they are to a discount.
  • Recipes, complete examples, starting with a site-wide coupon.

We can take it from here.

We take on the Craft and Craft Commerce sites you built, so you can get back to building. Introduce a client who signs a management contract and you get a $3K partnership fee.

How the Dev Partnership Program works
Book a call with Stephen