Will Snipcart work if a site/product page requires user authentication to view?

I’d like to confirm that Snipcart will work correctly if the product is on a static site (or section of a site) that requires authentication to view. I assume it will but I’d just like to make sure. Thanks.

Snipcart validates product orders by requesting the product page from their servers (to ensure the client hasn’t modified the product), so they will need some way to access the page. If they can’t access the product page, they can’t validate the order.

If you can’t allow the validation crawler to view the product page, you can provide it with a json file instead. Regardless of whether its a webpage or json file, it will need to be set on the data-item-url field.

You can refer to the documentation covering order validation here: Order validation – Snipcart Documentation

2 Likes

Thanks very much for clarifying that.

I use Jekyll within CloudCannon, so I could look to autogenerate a JSON file for all products with each new build. This file could be accessed from outside the authenticated part of the site and my data-item-url values in each product would point to this file. That’s if I’m interpreting things correctly.

I haven’t tested it, so I can’t say with 100% certainty, but I believe that should work!

I’m a while off doing it yet, but I will post how it goes.
Cheers, appreciate the help.

1 Like