I don’t want to take my site offline every time I want to test changes to the store. What is the procedure for having a staging site to test changes without changing production live?
The exact details of setting up a staging environment are going to depend on how you’re developing and deploying your website.
Most likely, you’ll need to deploy a domain that uses your Production API key and deploy a domain or subdomain that uses your Test API key.
On your Snipcart dashboard, you can toggle between Live and Test to see the API key for each environment (note: both of these environments are “alive” simultaneously. The toggle just changes which environment you are viewing)
I’ll also share with you what I’m doing for my own website:
- In my code repository, I have a
master
branch and adevelop
branch. - When I commit/merge changes to my
develop
branch, it launches a build process that is configured to use my development environment variables – for Snipcart, it uses the Test API key. This is deployed tohttps://dev.mydomain.com
where I can verify that changes are working correctly - After verifying changes to my
develop
branch, I commit/merge changes to mymaster
branch which it launches a build process that is configured to use production environment variables – for Snipcart, it uses the Live API key. This is deployed tohttps://mydomain.com
Okay, thanks. For some reason, I was thinking the test/live toggle switched live on and off. It’s good to know it doesn’t do that.
Cheers.
You’re welcome, glad that’s all it was! I was unsure of that when I first starting using Snipcart as well