You're viewing the documentation of an older Simple Commerce version. Consider upgrading to the latest for new features and bug fixes.

Simple Commerce provides a collection of API methods that developers can hook into to extend Simple Commerce.

We've tried to document some of the most popular APIs that Simple Commerce offers.


Simple Commerce is built upon the 'repository pattern'. You can access repositories by using the related facade.

For example, if I wanted to get a customer from their email address, I'd do something like this:

1use DoubleThreeDigital\SimpleCommerce\Facades;
3return Customer::findByEmail('');

The repositories provided by Simple Commerce automatically works with Statamic's collections and entry system but say for example, you wanted to store customers in a database instead. You could write your own Customer Repository, implementing all of the same methods as the default one and you could switch to yours instead by adding this to your service provider.

1$this->app->bind(DoubleThreeDigital\SimpleCommerce\Contracts\CustomerRepository::class, Your\Package\Repositories\CustomerRepository::class);


Simple Commerce also has its own set of events that you can listen out for in your site. These can come in useful if you want to fulfill something once an order has completed or you want a Slack notification when a coupon has been redeemed.

To listen for events, you can use Laravel's event listeners.

Last updated 3 months ago Improve this page on GitHub!