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.

IS BROKEN CHANGES ?? update attributes by /cart/update.js delete another attributes

Solved

IS BROKEN CHANGES ?? update attributes by /cart/update.js delete another attributes

qsm
Tourist
6 1 0

I have acode that update cart attributes twice:
1. Using the HTML "name" definition

 

 

 

<input type="checkbox" id="terms" name="attributes[Terms accepted]" value="Yes" checked required />

 

 

2. Using a JS api request

 

 

var request = {
   method: 'POST', headers: headers,
   body: JSON.stringify({ attributes: { 
        'all-in-one': null , 
        'data': null
        } 
   })
};
fetch('/cart/update.js', request).then(function() { location.href = '/cart'; });

 

 

The updates are performed on different fields in the attributes
It has worked fine for me so far

 

Starting today with every update the previous updating is deleted!!!!!

 

I would appreciate your help

Accepted Solution (1)

qsm
Tourist
6 1 0

This is an accepted solution.

I found a workaround, I checked and it works fine
Repeated use of "/cart/update.js" service request does not overwrite data
I removed the "name" HTML definition and added handling the update of the value by JS code

View solution in original post

Replies 2 (2)

qsm
Tourist
6 1 0

This is an accepted solution.

I found a workaround, I checked and it works fine
Repeated use of "/cart/update.js" service request does not overwrite data
I removed the "name" HTML definition and added handling the update of the value by JS code

szczepan
Shopify Partner
5 0 0

How? Do you have an example?