Extending yStore
yStore exposes a rich set of PHP events and registration hooks that let you add custom behavior without modifying plugin code. All extensions live in your own Craft CMS module or plugin.
Craft Module required
To subscribe to events or register extensions, you need a Craft CMS module. If you don't have one yet, see the Craft CMS module guide.
Quick example
// modules/MyModule/Module.php
public function init(): void
{
parent::init();
Event::on(
\yui\craft\services\CheckoutService::class,
\yui\craft\services\CheckoutService::EVENT_AFTER_PURCHASE_SUCCESS,
function (\yui\craft\events\CheckoutPurchaseEvent $event) {
// React to a successful purchase
// $event->order, $event->quote, $event->currency
}
);
}