Unable to update variant price

Tourist
6 0 0

I am sending the following to update a price for Product Variant and can't figure out why it does not work. 

 

PUT https://xxx-store-com.myshopify.com/admin/variants/17247133368391.json{"variants":[{"id":17247133368...}]} HTTP/1.1

 

The return is as follows:

 

HTTP/1.1 303 See Other
Date: Thu, 07 Nov 2019 19:13:50 GMT
Content-Type: text/html; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
X-Sorting-Hat-PodId: 137
X-Sorting-Hat-ShopId: 5531959367
Referrer-Policy: origin-when-cross-origin
X-Frame-Options: DENY
Location: https://xxx-store-com.myshopify.com/admin/auth/login
Set-Cookie: request_method=PUT; path=/
X-Shopify-Stage: production
Content-Security-Policy: frame-ancestors 'none'; report-uri /csp-report?source%5Baction%5D=update&source%5Bapp%5D=Shopify&source%5Bcontroller%5D=admin%2Fproduct_variants&source%5Bsection%5D=admin&source%5Buuid%5D=4826bce1-d361-4c1e-8fff-e7f9b630d553
X-Content-Type-Options: nosniff
X-Download-Options: noopen
X-Permitted-Cross-Domain-Policies: none
X-XSS-Protection: 1; mode=block; report=/xss-report?source%5Baction%5D=update&source%5Bapp%5D=Shopify&source%5Bcontroller%5D=admin%2Fproduct_variants&source%5Bsection%5D=admin&source%5Buuid%5D=4826bce1-d361-4c1e-8fff-e7f9b630d553
X-Dc: gcp-us-east1,gcp-us-central1,gcp-us-central1
NEL: {"report_to":"network-errors","max_age":2592000,"failure_fraction":0.01,"success_fraction":0.0001}
Report-To: {"group":"network-errors","max_age":2592000,"endpoints":[{"url":"https://monorail-edge.shopifycloud.com/v1/reports/nel/20190325/shopify"}]}
X-Request-ID: 4826bce1-d361-4c1e-8fff-e7f9b630d553
NEL: {"report_to":"network-errors","max_age":2592000,"failure_fraction":0.01,"success_fraction":0.0001}
Report-To: {"group":"network-errors","max_age":2592000,"endpoints":[{"url":"https://monorail-edge.shopifycloud.com/v1/reports/nel/20190325/shopify"}]}
CF-Cache-Status: DYNAMIC
Expect-CT: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
Server: cloudflare
CF-RAY: 5321a0735a9cc7f2-DFW

79
<html><body>You are being <a href="https://xxx-store-com.myshopify.com/admin/auth/login">redirected</a>.</body></html>
0

0 Likes
Shopify Staff
Shopify Staff
379 12 43

Hi, @TxBob77 

 

Elle here from Shopify.

I've moved your post to our API board so you can receive a better response. 

 

Cheers,

Elle

Elle | Social Care @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit the Shopify Help Center or the Shopify Blog

1 Like
Shopify Staff
Shopify Staff
188 20 19

Hi @TxBob77 

 

You will want to ensure your API call is setup similar to this: 

 

PUT .../admin/api/2019-10/products/12345678.json

 

Then in the JSON body of that request you will want something along the lines of: 

 

{
  "product": {
    "id": 12345678,
    "title": "Updated Product Title",
    "variants": [
      {
        "id": 87654321,
        "price": "2000.00"
      }
    ]
  }
}

You will also want to ensure you are not sending cookies with your requests. 

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


0 Likes