POST : xyz.com/wp-json/wc/store/cart/add-item I'm Developing a mobile woocommerce application and try to add-item in cart but getting some error please help to fix this problem thanks.
In Body:
{
"id": "8924",
"quantity":1,
"variation": [
{
"items" :{
"attribute": "hj",
"value": "knk"
}
}
]
}
Error:
{
"code": "woocommerce_rest_missing_nonce",
"message": "Missing the X-WC-Store-API-Nonce header. This endpoint requires a valid nonce.",
"data": {
"status": 401
}
}
You need to pass back a nonce as a header, previously X-WC-Store-API-Nonce
, now just Nonce
.
A nonce is required on all POST
requests and all requests to store/checkout
. You can get a nonce on every response you get from the server, so if you hit store/cart
, you will get a nonce, save that nonce and use it for future requests, but make sure to update it after each response.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With