Solved

/cart/update.js not working despise status 200

Cammyx
Tourist
3 1 2

Hello, i am working on a features to add custom messages in the cart order to ship little cards in my packages.
The issue is that i have to do that in javascript. I'm using the cart API and i use the cart/update.js Fetch.
despise having a status 200 the attributes i'm adding are not display in the cart informations.

Underneath a screenshot of what i wrote:

Capture d’écran 2023-05-09 à 17.12.52.png

Accepted Solution (1)
Cammyx
Tourist
3 1 2

This is an accepted solution.

Coming back to you to let you know that it finally worked,

The issues were:

the 'applications/Js" should be "applications/json"

the body was not correct: "attributes : attributes" is the correct way

and the lines were after a redirection that were causing the GET to not work the right way.

Thanks anyway!

View solution in original post

Replies 5 (5)

made4Uo
Shopify Partner
3821 716 1153

Hi @Cammyx,

 

If you want to just add a little note to the order, I would suggest using the line-item property instead. 

If this fixed your issue Likes and Accept as Solution is highly appreciated. Coffee tips fuels my dedication.
Get EXPERIENCED Shopify developers at affordable rates—visit Made4Uo.com for quick quote!
Do not lost your Shopify store! Get FREE trial with ✔️ Rewind Backup: Automatic, reliable, stress-free
Cammyx
Tourist
3 1 2

Hello, thank for your help but it's for a custom card the enterprise that i work with require an object in the attributes of the order, so i have no other choices. 😕

made4Uo
Shopify Partner
3821 716 1153

Since the line-item properties display in cart and checkout page, I would recommend you input your value to the line-item property using javascript

If this fixed your issue Likes and Accept as Solution is highly appreciated. Coffee tips fuels my dedication.
Get EXPERIENCED Shopify developers at affordable rates—visit Made4Uo.com for quick quote!
Do not lost your Shopify store! Get FREE trial with ✔️ Rewind Backup: Automatic, reliable, stress-free
Cammyx
Tourist
3 1 2

This is an accepted solution.

Coming back to you to let you know that it finally worked,

The issues were:

the 'applications/Js" should be "applications/json"

the body was not correct: "attributes : attributes" is the correct way

and the lines were after a redirection that were causing the GET to not work the right way.

Thanks anyway!

made4Uo
Shopify Partner
3821 716 1153

Oh. I overlooked that error

If this fixed your issue Likes and Accept as Solution is highly appreciated. Coffee tips fuels my dedication.
Get EXPERIENCED Shopify developers at affordable rates—visit Made4Uo.com for quick quote!
Do not lost your Shopify store! Get FREE trial with ✔️ Rewind Backup: Automatic, reliable, stress-free