Jump to content

Calling Squarespace API in code block?

Recommended Posts

So I have a question. Would I be able to call the Squaresapce API through javascript thats in a code block?

As of now I have a code block which contains quite a large script and it basically involves the user adding products to an order list, but in a certain way (without going too much into the details).  The problem is that this order list is not in any way associated with products I have in my store. What I want is that when a user adds one of theese products in the code that runs in the code block, the shopping cart should be updated. Like is it possible to add a line of code in the code block that does something like the following:

When a user adds a component :

javascript pseudo code:

squarespaceAPI.call.addProduct(product).toCart(User)

Thanks!

 

Link to comment
  • Replies 2
  • Views 488
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

I am not sure that I fully understand your question (a link to the site may help) but to add products to the Squarespace cart, they must have been created as products on a Squarespace store page.

About me: I'm Paul, a SQSP user for over 18 yrs and a Circle Leader since 2017. I value honesty, transparency, diversity and good design ♥.
Work: Founder of SF.DIGITAL, providing high quality original extensions to supercharge your Squarespace website. 
Content: Views and opinions are my own. Links in my posts may refer to my own SF.DIGITAL products or may be affiliate links.
Forum advice is completely free. You can thank me by selecting a feedback emoji below. Buying a coffee is optional.

Book paid help with domains: Connect a GoDaddy domain. Connect a Squarespace Domain. Domain assistance

Link to comment

Hi!

Yes I do understand that I need to add the products to my site, but the way I want to add them / remove them to/from the customers cart is where I am thinking of the possibility of using the Squarespace API to accomplish this. 

A link to the site is here:
https://www.smarti.dev/smarti-configuration-tool

When entering the site, select a couple of floors, and select how many rooms there are for each floor and press the generate button. 

What I am trying to accomplish is that when a user clicks on the "Add Component" button in a room and selects one, that item should be added to the cart. This should also work for removing the item and updating the amount. 

 

Thanks!

Link to comment

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.