Product variant update

Solved
Highlighted
New Member
2 0 1

Hi everyone,

I'm trying to update my product price through the product variant using Postman. Does anyone know the required parameters?
I'm using the payload from the documentation (https://shopify.dev/docs/admin-api/rest/reference/products/product-variant#update-2020-10).

https://{{api_key}}:{{password}}@{{store}}.myshopify.com/admin/api/2020-10/variants/{{variant_id}}.json


This is Postman's response:

{
    "errors": {
        "variant": "Required parameter missing or invalid"
    }
}

 

Thanks in advance!

0 Likes
Highlighted
Shopify Partner
593 41 118

Can you please supply your JSON request body you are sending?

0 Likes
Highlighted
Shopify Partner
11 3 0

This is an accepted solution.

Make sure you are using the PUT method, not the POST method... (don't know if that is the case but it is a common gotcha!)  For other readers: https://shopify.dev/docs/admin-api/rest/reference/products/product-variant#create-2020-07

In our experience, it is a good idea to first do a GET on the same endpoint, this will then return the current product data structure. You can then edit the fields you want to change and use this as the POST data, that ensures that your schema is always up to date! Use a tool like Postman for more detailed response data, before you chuck it into your application!

Sounds like you have a "required" feedback in your variant that you haven't included in the PUT request body...

The Shop Front: Welcome to the eCommerce platform with integrated video, audio and chat. Engage with your customers online and offline with multi-channel conversion tools. Edit your products and prices in realtime and stream them privately. Available in the App store: https://apps.shopify.com/the-shop-front
0 Likes
Highlighted
New Member
2 0 1

Using the GET method first did the trick. I made a format error in the PUT request body.
It looks like it doesn't have any required fields either. I was able to update the price without entering anything else.
So this still worked in Postman:

PUT https://{api_key}:{password}@{store}.myshopify.com/admin/api/2020-10/variants/{variant_id}.json

{
  "variant": {
    "price": "999.00"
  }
}

 
Thanks a lot for the help!

1 Like