How do I make one product go directly to checkout in Squarespace?

Note: this is an older post and this technique does not appear to work anymore. I'm leaving it here for posterity and maybe it will help inspire a solution that works for you.

I was tasked with this goal recently: with Squarespace Commerce have the entire site use the shopping cart EXCEPT for one product which should go directly to checkout (known as "Express Checkout" in Squarespace).

While I didn't find a way to do it per-product I did find a way to do it per-page.

The catch is that if you are using a public Store page it will not work on the index view. However, it can work on the detail page or if you are adding your product to a regular page using a Product block.

Here is the code you'll need to add:

<script>
// make entire page use "express checkout" (no cart)
Static.SQUARESPACE_CONTEXT.websiteSettings.storeSettings.expressCheckout = true;
</script>

If using a public Store page

Add the above code in a Code block in the product's Additional Info area found by editing the product in your Inventory.

If using a Product block

On the Page Settings for the page that has the Product block go to Advanced and add the code in the Page Header Code Injection field.

In either case if the script is added you should see the Add to Cart button change to Purchase.

Notes

  • This will affect ALL products on the page.

  • Of course this can also be done conditionally with more advanced JavaScript. For example, invoke the script if a certain product is found on the current page.

  • Currently this is only tested on Squarespace 7.0, but it might work on 7.1 as well.

Kirk Roberts

Sample bio text. Can also be a “call to action” to get in touch via whatever communication method you prefer.

https://kirkroberts.com
Previous
Previous

Automatically add “View Event” buttons to a Squarespace 7.1 Events page

Next
Next

The wonderful stupidity of Mini Habits