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;23return Customer::findByEmail('firstname.lastname@example.org');
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.
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.