Jump to content

orderId variable during checkout code injection is incorrect.

Recommended Posts

Site URL: https://www.barboxsports.com

Hello, I am trying to create a system where when a customer checks out, a google sheet is automatically updated. I have created a dedicated server that simply needs to be called with an order number parameter which I have set up to occur at checkout, however the supplied orderId variable (supplied by Squarespace) is usually incorrect. I will check the console and see that the URL is being provided with an ID that is roughly 50 orders behind, however when I check the source the number seems to be correct (see my screenshot for an example of an orderId which should be 153 but orderId 107 was called). 

Occasionally the correct ID will be used and everything will work as intended. What's even stranger is the incorrect/old IDs are counting up. 

I'm not sure where I would post this to support so I figured I would ask here first. Any help would be much appreciated.

Screen Shot 2021-10-27 at 5.24.14 PM.png

Link to comment
  • 2 weeks later...
  • Replies 3
  • Views 1.5k
  • Created
  • Last Reply

Top Posters In This Topic

On 10/28/2021 at 5:42 AM, Nathanael777 said:

Site URL: https://www.barboxsports.com

Hello, I am trying to create a system where when a customer checks out, a google sheet is automatically updated. I have created a dedicated server that simply needs to be called with an order number parameter which I have set up to occur at checkout, however the supplied orderId variable (supplied by Squarespace) is usually incorrect. I will check the console and see that the URL is being provided with an ID that is roughly 50 orders behind, however when I check the source the number seems to be correct (see my screenshot for an example of an orderId which should be 153 but orderId 107 was called). 

Occasionally the correct ID will be used and everything will work as intended. What's even stranger is the incorrect/old IDs are counting up. 

I'm not sure where I would post this to support so I figured I would ask here first. Any help would be much appreciated.

Screen Shot 2021-10-27 at 5.24.14 PM.png

Can you use the low code tool Integromat to connect your store and listen to new order event then check the id there to see the potential issue

BeyondSpace - Squarespace Website Developer

🖼️ Lightbox Studio (Enable Pinch/Zoom on lightbox, video lightbox and much more)
🗓️ Delivery Date Picker (Squarespace Date picker form field)
💫 Gallery block 7.1 workaround
🥳 No-code customisations for Squarespace (+100 Spark plugin customisations)
🚀 Learn how to rank new pages on Google in 48 hours!

If you find my answer useful, let's leave a like or upvote so others with the same issue can find their solution. Thank you!

Link to comment

In case someone finds this question I'll give the solution I came to:

Ultimately the issue was solved by creating my own variable and setting it to the value of "{orderId}". The value was being calculated as an octal integer literal which is what was causing the change in numbers. I was using interpolation originally which is why I didn't think to wrap the initial value in a string. 

Link to comment
  • 2 years later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.