Get Started

Configuration

You can customise Snipcart’s settings using a PHP configuration file. This is optional: each setting has a default, so you only need to include the values you want to change.

To override a setting, create snipcart.php in your Craft project’s /config directory and return an array of setting names and values. For example, the following will set the default currency to US dollars:

<?php

return [
    'defaultCurrency' => 'usd',
];

All other settings keep their defaults. Add any further settings you want to change to the same array. The options below explain the available settings and their defaults. You can also manage many of these settings in the control panel under Settings → Snipcart.

Configuration Options

publicApiKey

Snipcart API key.

  • `secretApiKey - Snipcart secret API key.

defaultCurrency

The default currency.

sendOrderNotificationEmail

Whether to send order notifications to designated store admins.

notificationEmails

A collection of email addresses for admins who want order notifications.

notificationEmailTemplate

Custom template to be used for admin order notification emails.

sendCustomerOrderNotificationEmail

Whether to send completed order notifications to customers.

customerNotificationEmailTemplate

Custom template path for customer order notification emails.

reduceQuantitiesOnOrder

Whether to decrement product quantities when orders are processed.

orderGiftNoteFieldName

The name (not handle) of a custom field for Gift Notes, as sent to Snipcart.

orderCommentsFieldName

The name (not handle) of a custom field for order comments, as sent to Snipcart.

cacheResponses

Cache Snipcart API responses.

cacheDurationLimit

Snipcart API response cache duration.

logCustomRates

Whether to log responses to shippingrates.fetch webhook events for troubleshooting.

webhookLogRetentionDays

The number of days to retain valid incoming webhook requests for troubleshooting before Craft garbage collection can delete them. Set this to 0 to retain them indefinitely.

Provider Settings

Return an array with the config settings for any shipping providers.

<?php

return [
    '*' => [
        // ...
        'providerSettings' => [
            'shipStation' => [
                'apiKey' => '',
                'apiSecret' => '',
                'defaultCarrierCode' => '',
                'defaultPackageCode' => '',
                'defaultCountry' => 'US', // Required
                'defaultWarehouseId' => 0, // Required
                'defaultOrderConfirmation' => 'delivery', // Required
                'enableShippingRates' => false,
                'sendCompletedOrders' => false,
            ],
        ],
    ],
];

Shipping Address

Return an array for the address to be used for rate quotes and orders with shipping providers.

<?php

return [
    '*' => [
        // ...
        'shipFromAddress' => [
            'name' => '',
            'address1' => '',
            'address2' => '',
            'city' => '',
            'state' => '',
            'zip' => '',
            'country' => '',
            'phone' => '',
            'email' => '',
        ],
    ],
];

publicTestApiKey

The public API key for the test account, selected when test mode is enabled.

secretApiKey

The secret API key for live server-side requests. Keep it out of public templates.

secretTestApiKey

The secret API key for test server-side requests.

enabledCurrencies

The currency codes enabled for the store. The default enables US dollars.

providers

Provider configuration for shipping integrations. Keep provider-specific options with the relevant shipping setup.

reFeedAttemptWindow

How many minutes an order remains eligible for re-feeding when the verification command finds it missing from ShipStation.

testMode

Whether to select the test API keys instead of the live keys.

sendTestModeEmail

Whether to send notification emails while testing.