Liquid, JavaScript, themes, sales channels
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!
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'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,
Having the exact same issue, would love to know if there is a solution.
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).
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.
Are you ready to take your business to the next level? Look no further than the latest ...
By SarahF_Shopify Apr 15, 2024We’re keeping the ball rolling to make sure you’re always ahead of the game. So buckle ...
By JasonH Apr 8, 2024Portrait of Stephen positioned next to an image of planet Earth, with the Stephen's World ...
By JasonH Mar 18, 2024