Skip to content

Commerce Foundations is our pre-built Craft Commerce store. See what it includes

Craft CMS plugins

Advanced Discounts

A Craft CMS plugin that builds multi-tier Craft Commerce discounts from flexible cart rules.

Events

Events the plugin fires, and what to do with them.

DiscountTypes::EVENT_REGISTER_DISCOUNT_TYPES#

Fires: when the plugin builds the list of available discount types, on every call to DiscountTypes::getAllDiscountTypes().

Payload: craft\events\RegisterComponentTypesEvent

Property Type Notes
types array<int, class-string> Pre-populated with AdvancedDiscountType and BuyXGetYDiscountType. Append your own class, which must implement DiscountTypeInterface.

Listen:

use craft\events\RegisterComponentTypesEvent;
use fostercommerce\advanceddiscounts\services\DiscountTypes;
use yii\base\Event;

Event::on(
    DiscountTypes::class,
    DiscountTypes::EVENT_REGISTER_DISCOUNT_TYPES,
    static function (RegisterComponentTypesEvent $event): void {
        $event->types[] = MyDiscountType::class;
    }
);

Common use: adding a discount type with its own action rules, such as a tiered freight promotion. See custom discount types for the class you register here.

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 $3,000 partnership fee.

How the Dev Partnership Program works
See if we’re a fit