What's your biggest current challenge? Have your say in Community Polls along the right column.
Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

Change multiple Cart Items at once (quantity and selling_plan)

Solved

Change multiple Cart Items at once (quantity and selling_plan)

Erik_Abrio
Shopify Partner
29 6 10

Hi,

In our Shop we have implemented a Bundle Logic bundling 2 to 8 products into one. In our Cart we show the bundle all in one Card with incredients. In order to change quantity and selling plan in our cart its necessary to change all items in one bundle. I dont know what exactly im doing wrong here but i always get bad requests.

let updateItems = {"id":"43603405996260:dbd0192e627f613dbadb11c7e9fd9a02", "quantity": 3, "selling_plan": 3613196516}

let updateItems2 = {items:[{'id':'436034260:dbd0192e627f61311c7e9fd9a02','quantity':3,'selling_plan':36136516},{'id':'43604534260:dbd0192e627f61311c7e9fd9a02','quantity':2,'selling_plan':3612136516}]}
updateCartItem(updateItems)
updateCartItem(updateItems2)

function updateCartItem (item) {
    fetch('/cart/change.js', 
      {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json'
      },
      body: JSON.stringify({
        updates:
        item
      })
    })
    .then(response => { 
      response.json();
      console.log(response)  
    } 
    )
.catch(console.error)


  }

 Many thanks 🙂

Accepted Solution (1)

Erik_Abrio
Shopify Partner
29 6 10

This is an accepted solution.

Cart Change Js is not working with bulk operations. The only Solution at this point is to delete and add them again.

View solution in original post

Reply 1 (1)

Erik_Abrio
Shopify Partner
29 6 10

This is an accepted solution.

Cart Change Js is not working with bulk operations. The only Solution at this point is to delete and add them again.