Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
We're developing a Shopify App that implements the add to cart functionality from the Ajax API.
Is there a way that we can programatically get the required section ids from the theme so that we can make a bundled rendering of the cart, regardless of the theme being used?
const formData = new FormData()
formData.append('id', variantId)
formData.append('quantity', quantity)
formData.append('utf8', '✓')
formData.append('form_type', 'product')
formData.append('sections', sections) // ← This is the value we are missing
await fetch(`/cart/add`, {
method: 'POST',
headers: {
'x-requested-with': 'XMLHttpRequest',
accept: 'application/javascript',
'Content-Type': 'multipart/form-data',
},
body: JSON.stringify(formData)
});
Learn 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, 2025Discover opportunities to improve SEO with new guidance available from Shopify’s growth...
By Jacqui May 1, 2025