Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
I am trying to make a "kit builder" for my friends shopify store.
I'm very new to web dev.
i basically want to have blocks of products in which a customer can select 1 product form each block. When they select a product i update an array in my script to store the currently selected products. then I have a button that should call the api to add these items to cart. but whenever i try to do this I get a 404 saying:
{"status":"bad_request","message":"Parameter Missing or Invalid","description":"Required parameter missing or invalid: items"}
I have simplified everything to the example request in the docs:
function checkout(){
let formData = {
'items': [{
'id': 8117069185265,
'quantity': 1
}]
};
fetch(window.Shopify.routes.root + 'cart/add.js', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(formData)
})
.then(response => {
return response.json();
})
.catch((error) => {
console.error('Error:', error);
});
}
Discover how to increase the efficiency of commerce operations with Shopify Academy's l...
By Jacqui Mar 26, 2025Shopify and our financial partners regularly review and update verification requiremen...
By Jacqui Mar 14, 2025Unlock the potential of marketing on your business growth with Shopify Academy's late...
By Shopify Mar 12, 2025