Cart API Update not working reliably

garyrgilbert
Shopify Partner
82 8 23

Hi there,

 

I am trying to add a note to the order in the checkout (shopify plus account) and am using the cart api to accomplish this via https://shopify.dev/docs/themes/ajax-api/reference/cart

 

Checkout.jQuery.post('/cart/update.js', JSON.stringify({note: 'test note'}), function(){console.log(arguments)},"json" );

 

 

In my tests, I end up with quite a few orders without any notes attached even though I get a 200 status back when dumping out the result of the call to the console.. the note is even visible in the result, but when I check the order/abandoned checkout (when not completing the order) the notes are "sometimes" not there.  I can not reliably determine when a note will not be added to the order because I always get a 200 status back.

 

Furthermore, it seems like it's even flakier if you try to overwrite an existing note. Again, you get a 200 status back but the note remains the same.

Anyone have any ideas?

 

Cheers,

 

Gary

- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
Replies 3 (3)
Elías
Tourist
17 0 2

I have this same issue! I do a note update and the response shows the new value. If I fetch the cart again, I get the old value. What's happening here?

jcode
New Member
4 0 0

Yes, I am getting the same issue..!! the value is updating only in the second fetch! Any fix? 

jcode
New Member
4 0 0

I wrote the same fn twice. so it's execute twice. Its the only way I found. !!