Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
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.
Starting a B2B store is a big undertaking that requires careful planning and execution. W...
By JasonH Sep 23, 2024By investing 30 minutes of your time, you can unlock the potential for increased sales,...
By Jacqui Sep 11, 2024We appreciate the diverse ways you participate in and engage with the Shopify Communi...
By JasonH Sep 9, 2024