Events
Handling events in your store
You might want to send an order confirmation email when an order is marked as completed.
This package will fire off events at important stages in your store, that you can listen to:
Here is a list of events fired:
Event | Description | Available Properties |
---|---|---|
OrderCompleted | An order has been completed | $order - the Order |
CouponRedeemed | A coupon has been redeemed | $coupon - the Coupon |
The CouponRedeemed
event is also used internally to increment the times_used
of the Coupon.
Listening to events
Just add your listener to EventServiceProvider
's $listen
array:
protected $listen = [
// ...
\YiddisheKop\LaravelCommerce\Events\OrderCompleted::class => [
\App\Listeners\SendOrderConfirmationEmail::class,
// ...
],
];
See the Laravel events documentation for more on how to create listeners.