How can I post /cart/update.js on checkout in Shopify Plus?

Markus4xD
Shopify Partner
21 0 1

Is there a way to POST /cart/update.js on checkout. I know it can be used at the cart page but doesn't seem to work on the checkout page. I just need a way to update the cart while on the checkout steps. Our shop has a Shopify Plus Plan.

 

Thanks!

Replies 5 (5)

Jason
Shopify Expert
11190 225 2283

Not all checkouts will have a cart in the first place so posting back there makes no sense. Do your checkouts have a cart or are they created via other channels - like Draft Orders? Depending on what step you're on would also impact what happens to the currency Checkout object.

 

What doesn't work? Do you get an error message? Got an example we can see?

★ I jump on these forums in my free time to help and share some insights. Not looking to be hired, and not looking for work. http://freakdesign.com.au ★
Markus4xD
Shopify Partner
21 0 1

I'm trying to update the cart.attributes property on the checkout page.

 

On the cart page, I do this by running the javascript code using jQuery. 

$.post('/cart/update.js', { attributes : { "my-attribute": "my-attribute-value" } } );

 

On checkout page, I ran the code:

$.post('/cart/update.js', { attributes : { "my-attribute": "my-attribute-value-updated" } } );

The code does not update the "my-attribute" value. Is there any other way to change it? Or in some cases even delete it?

 

Thanks,

sadiesaurdiff
Visitor
2 0 0

Having the exact same issue, would love to know if there is a solution. 

sadiesaurdiff
Visitor
2 0 0

Try posting to /cart.js instead, that's working for me! Also, make sure if you are using jQuery in checkout that you are adding jQuery (it's not added by default). 

SuperBand
Shopify Partner
9 2 0

I'm using Vanilla JS - so using the xhr method. But I'm running into this same issue. I'm trying to post a cart attribute after shipping has been selected and a customer clicks "Continue to payment".

 

Console returns a 200 indicating it was successful and the Cart API Reference shopify provides doesnt indicate that we *cant* do a POST to the cart at checkout.

 

Pretty lost on this one.