Configuration
You can configure Snipcart for Statamic with the configuration options outlined below.

Sites

Set the currency, length and weight units for each Statamic site. The units set for Statamic's default site act as default Snipcart units. The units of your other sites will be converted from it.
Supported currencies: ISO 4217 letter codes supported by Snipcart, eg. USD or EUR Supported length units: cm, m, in, ft Supported weight units: g, kg, oz, lb
1
'sites' => [
2
3
'default' => [
4
'currency' => 'USD',
5
'length' => 'in',
6
'weight' => 'oz',
7
],
8
9
],
Copied!
Make sure to keep the sites in sync with your Statamic sites. You can do so by running the sync-sites command.
Whenever you update a site, you need to run the setup command to update your products collection and entries.

Collections & Taxonomies

Define the handles of the products collection and categories taxonomy.
1
'collections' => [
2
'products' => 'products',
3
],
4
5
'taxonomies' => [
6
'categories' => 'categories',
7
],
Copied!
Whenever you change a handle, you need to run the setup command to setup the new products collection and categories taxonomy.

Snipcart API Keys

Your Snipcart API Keys for the Live and Test Environment.
1
'live_key' => env('SNIPCART_LIVE_KEY'),
2
'live_secret' => env('SNIPCART_LIVE_SECRET'),
3
4
'test_key' => env('SNIPCART_TEST_KEY'),
5
'test_secret' => env('SNIPCART_TEST_SECRET'),
Copied!

Test Mode

Set this to false to start processing real transactions. You probably want to do this in production only.
1
'test_mode' => env('SNIPCART_TEST_MODE', true),
Copied!

Snipcart Version

The Snipcart version you want to use.
1
'version' => '3.0.29',
Copied!

Cart Behaviour

Set this to none to prevent the cart from opening every time a product is added. Default is null.
1
'behaviour' => null,
Copied!

Cart Image

Define a Glide preset to be applied to the product image that shows in the cart. You may also turn the manipulation off (not recommended).
1
'image' => [
2
'manipulation' => true,
3
'preset' => ['w' => 240, 'q' => 75],
4
]
Copied!

Snipcart API Cache Lifetime

Define the cache lifetime of Snipcart API responses in seconds. The API is used for things like fetching the stock of a product.
1
'api_cache_lifetime' => 3600,
Copied!

Snipcart Webhook Route

Define the route where the Snipcart webhook requests will be sent to. Don't forget to add this URL in your Snipcart Dashboard. Set this to null to remove the route.
1
'webhook' => 'webhooks/snipcart',
Copied!
Last modified 9mo ago