Using API PUT return status 200 But nothing changed.

Highlighted
New Member
1 0 0

I'm so new to shopify.

 

Sorry I know this topic is not completely new.

I tried all solutions that I found about this issue, but mine is still not working.

 

I read and tried,

 

I'm trying to update variant.compare_at_price value, and returned status is 200, but nothing is changed.

 

ENV

node.js "v12.14.1"

axios "^0.19.2"

 

axios({
method: 'put',
url: `${domain}/admin/api/2020-01/variants/${variant_id}.json`,
data: {
"variant": {
"id": variant_id,
"compare_at_price": 100
}
},
headers: {'Cookie': cookie_str}
}).then(d => {
console.log(d.data)
res.end()
})

 

Thanks you for reading and helping.

 

 

0 Likes
Highlighted
Shopify Staff (Retired)
Shopify Staff (Retired)
624 103 124

Hey @HaydenJung ,

 

I'm fairly sure that the "compare_at_price" field should be a String, not an Integer.

 

Try updating your code to this, and see if this helps:

 

axios({
    method: 'put',
    url: `${domain}/admin/api/2020-01/variants/${variant_id}.json`,
    data: {
        "variant": {
            "id": variant_id,
            "compare_at_price": "100.00"
        }
    },
  headers: {'Cookie': cookie_str}
}).then(d => {
    console.log(d.data)
    res.end()
})

If this does not work, then please provide me with the value of the "X-Request-ID" header from the API response and I can investigate this further.

 

Hassain | Developer Support Specialist @ Shopify
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Click Accept as Solution 

0 Likes