Simple Commerce Logo

Customers

Customers are always right...

Storage

By default, customers are stored as Statamic Entries, similar to orders, products and coupons.

They live in their own customers collection, which you can change if you need to in the simple-commerce.php config file.

1/*
2|--------------------------------------------------------------------------
3| Content Drivers
4|--------------------------------------------------------------------------
5|
6| Normally, all of your products, orders, coupons & customers are stored as flat
7| file entries. This works great for small stores where you want to keep everything
8| simple. However, for more complex stores, you may want store your data somewhere else
9| (like a database). Here's where you'd swap that out.
10|
11| https://simple-commerce.duncanmcclean.com/extending/content-drivers
12|
13*/
14 
15'content' => [
16 // All the other bits..
17 
18 'customers' => [
19 'driver' => \DoubleThreeDigital\SimpleCommerce\Customers\Customer::class,
20 'collection' => 'customers',
21 'collection' => 'members',
22 ],
23],

Alternatively, you can store your customers as Statamic users.

This is often pretty handy if you're building some sort of membership site or if you want a way for your customers to log in, to view order history etc.

Hot Tip: You'll need to enable Statamic Pro if you want to store your customers as users.

To enable, change \DoubleThreeDigital\SimpleCommerce\Customers\Customer::class to \DoubleThreeDigital\SimpleCommerce\Customers\UserCustomer::class

1/*
2|--------------------------------------------------------------------------
3| Content Drivers
4|--------------------------------------------------------------------------
5|
6| Normally, all of your products, orders, coupons & customers are stored as flat
7| file entries. This works great for small stores where you want to keep everything
8| simple. However, for more complex stores, you may want store your data somewhere else
9| (like a database). Here's where you'd swap that out.
10|
11| https://simple-commerce.duncanmcclean.com/extending/content-drivers
12|
13*/
14'content' => [
15 // All the other bits..
16 
17 'customers' => [
18 'driver' => \DoubleThreeDigital\SimpleCommerce\Customers\Customer::class,
19 'driver' => \DoubleThreeDigital\SimpleCommerce\Customers\UserCustomer::class,
20 ],
21],

Tags

The {{ sc:customer }} tag is documented seperatly, see docs.

Need some help?

There's plenty of ways of getting help: either via opening a GitHub Issue, starting a conversation on the Statamic Discord or directly emailing me.