Dedicated to the Hydrogen framework, headless commerce, and building custom storefronts using the Storefront API.
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:
Solved! Go to the solution
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!
Hi @Cammyx,
If you want to just add a little note to the order, I would suggest using the line-item property instead.
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. 😕
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
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!
Oh. I overlooked that error