Order validation

A common misstep among users first integrating Snipcart is disregarding or "breaking" our order validation process.

Here are the two common mistakes we often see:

Invalid data-item-url

The most common reason for this is that the value specified in data-item-url is not valid.

Before completing the order, Snipcart makes an HTTP request to the value specified in this attribute to make sure the price and other important information have not been altered by someone who knows how to use browser developer tools.

You can read more about this in the security section.

The specified URL must be one where the Snipcart buy button for your product is available on the source of the page.

Important notice: For users with a single-page website, the data-item-url field should only be filled with your root domain name, such as www.example.com, or with a simple slash bar /.

Invalid domains setup

You also need to allow domains and sub-domains where Snipcart can crawl your products. If you log in to the dashboard and go to Store Configuration > Domains & URLs you will be able to set your default domain name as well as the additional allowed domains and sub-domains.

For instance, if the data-item-url value is http://test.mysite.com/products/1 and your default domain is mysite.com, our validation will fail. You will need to add test.mysite.com in the allowed sub-domains for it to work.

If you want, you can also use relative URL (/products/1). But we will only validate the product in your default domain name. So in the example above, if the data-item-url value was /products/1, we would make the HTTP request to validate the information to http://mysite.com/products/1.

To specify a relative URL, the data-item-url value must start with a /.

Was this article helpful?