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)
});