Squarespace Order Confirmation Page - Custom Tags & Info

The Problem: Missing important information on order confirmed -page.

There’s an important feature missing in Squarespace Ecommerce: getting detailed information about the order on the order confirmation page. Often we’d need these to pass information to third parties for analytics, affiliate stuff, product reviews etc.

This is a pretty quickly written blog post but should get the general idea shown so you can do it and customize to your needs.

Summary as a video demo

This will allow you to:

  1. Get details of purchased products (product name, price, sku and variant)

  2. Get detailed info about the price (Total price, Shipping price, Taxes, Discount).
    This will open you up for for calculations like total profit (total - taxes - shipping)

  3. Get variants to digital download products! (explained later)

The info we normally have is

  • {orderId}: The unique ID of the confirmed order

  • {orderSubtotal}: The subtotal of the confirmed order

  • {orderSubtotalCents}: The subtotal of the confirmed order, in cents

  • {orderGrandTotal}: The grand total of the confirmed order

  • {orderGrandTotalCents}: The grand total of the confirmed order, in cents

  • {customerEmailAddress}: The customer's email address, as it was entered in the "Billing Info" section

Screenshot 2018-11-26 12.32.00.png

This is missing tons of stuff we might need.

Let’s get to it!

As the needs related to this are quite specific I’ll only demonstrate the general underlying method needed to achieve this.

  1. Enable Developer mode

  2. Open site.region (or create a custom block and {@|apply} to site.region

  3. Paste to <head>:

{.section order} 
<script>  
 var siteJson = {@|json-pretty};
 console.log(siteJson);
</script>
{.end}

This simple code will give you all the information above.
Open your browser console to inspect the order information json. You’ll find the products, sku’s, all the price info etc.

Depending on what you need you can extend the custom javascript to pass the information to third parties.

Use SKU for variants and any custom info

A really useful hack is to use SKU to provide custom information. You can then split SKU to pieces and use those in order confirmation page. SKU could include“red-m” for variant info. It could include url to turn service product (which has variants unlike digital products) to a “digital download product”. It could include notes, description etc.

Add variants to digital download products

It’s now theoretically possible to create a service product instead of a digital download product and add variants. The way buyer gets the download is:

Make SKU something like !Product name!downloadurl
So it’d be !My song!/my-cool-song.mp3

You can now use javascript to append the song name and song download url to order confirmation page. Still testing whether this is a usable solution in production.

Need help?

This topic is way too broad to cover all use-cases so I could only write a general guide on how things are possible. I might include more code snippets in the future. However as we’re using about developer mode, this is probably beyond the skillset of most non-developers.

If you need help implementing custom tags or getting custom information on checkout page, get in touch at contact[at]voxpopagency.com.

petripottonen.enterprises -