Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
I am using a checkbox to add an item to a cart, and when it is unchecked, remove the item from the cart. Below is the error I am getting when trying to update the quantity of the item in the cart (removing it).
POST https://mywebsite.com/cart/update 404 (Not Found)
I tried replacing "routes.cart_update_url" with "routes.cart_add_url" and the error changes from (Not Found) to (Bad Request) meaning the request is actually made with the add url, just the body is invalid as it is not the proper format. I can't figure out why the "routes.cart_update_url" is causing a (Not Found).
Below is my JavaScript Code (protector is just a variable that holds the variant ID):
let updates = {
protector: 0
};
fetch(`${routes.cart_update_url}`, {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({ updates })
})
.then(response => response.json())
.then((response) => {
this.window.SLIDECART_UPDATE(response);
})
.catch((error) => {
console.error('Error:', error);
});
This is the hydrogen subforum for headless storefront architectures
Not for the online-sales channel themes.
Unless your doing something hinky with hydrogen you can report your own content to have it moved to the proper forum in the the three dot kebab menu on your post.
Either design or techQ&A.
https://shopify.dev/docs/custom-storefronts/hydrogen/getting-started
Contact paull.newton+shopifyforum@gmail.com for the solutions you need
Save time & money ,Ask Questions The Smart Way
Problem Solved? ✔Accept and Like solutions to help future merchants
Answers powered by coffee Thank Paul with a ☕ Coffee for more answers or donate to eff.org
June brought summer energy to our community. Members jumped in with solutions, clicked ...
By JasonH Jun 5, 2025Learn how to build powerful custom workflows in Shopify Flow with expert guidance from ...
By Jacqui May 7, 2025Did You Know? May is named after Maia, the Roman goddess of growth and flourishing! ...
By JasonH May 2, 2025