Install the addon, add your Snipcart API Keys and setup your views to get started.

Install Addon

Option 1: Install the addon with Composer.

composer require aerni/snipcart

Option 2: Install the addon through the Addons section in the Statamic Control Panel.

The vendor assets will be automatically published during the installation process. The addon's default config will be merged and the translations loaded.

If you get an error saying Fatal error: Allowed memory size of 1610612736 bytes exhausted, use this command instead:

COMPOSER_MEMORY_LIMIT=-1 composer require aerni/snipcart

Add Snipcart API Keys

Add your Snipcart API keys to your .env file. You can find the keys in your Snipcart dashboard.


Setup Views

Head Tag

Add this tag to the <head> of your view to render Snipcart's preconnect hints and stylesheet.

{{ snipcart:head }}

If you want more control, you may add the preconnect hints and stylesheet separately instead.

{{ snipcart:preconnect }}
{{ snipcart:stylesheet }}

Body Tag

Add this tag before the closing <body> tag of your view to render Snipcart's container and script.

{{ snipcart:body }}

If you want more control, you may add the container and script separately instead. Just make sure to include the script after the container.

{{ snipcart:container }}
{{ snipcart:script }}