Shopify API – Product Variant

top

Receive a list of all Product Variants

Get a list of product variants

GET /admin/products/#{id}/variants.xml

Get all variants for a product

Response

           
HTTP/1.1 200 OK
<?xml version="1.0" encoding="UTF-8"?>
<variants type="array">
  <variant>
    <compare-at-price type="decimal" nil="true"></compare-at-price>
    <created-at type="datetime">2009-10-20T07:28:51-04:00</created-at>
    <fulfillment-service>manual</fulfillment-service>
    <grams type="integer">200</grams>
    <id type="integer">808950810</id>
    <inventory-management>shopify</inventory-management>
    <inventory-policy>continue</inventory-policy>
    <inventory-quantity type="integer">10</inventory-quantity>
    <option1>Pink</option1>
    <option2 nil="true"></option2>
    <option3 nil="true"></option3>
    <position type="integer">1</position>
    <price type="decimal">199.00</price>
    <product-id type="integer">1706652214</product-id>
    <sku>IPOD2008PINK</sku>
    <title>Pink</title>
    <updated-at type="datetime">2009-10-20T07:28:51-04:00</updated-at>
  </variant>
  <variant>
    <compare-at-price type="decimal" nil="true"></compare-at-price>
    <created-at type="datetime">2009-10-20T07:28:51-04:00</created-at>
    <fulfillment-service>manual</fulfillment-service>
    <grams type="integer">200</grams>
    <id type="integer">1122890207</id>
    <inventory-management>shopify</inventory-management>
    <inventory-policy>continue</inventory-policy>
    <inventory-quantity type="integer">20</inventory-quantity>
    <option1>Red</option1>
    <option2 nil="true"></option2>
    <option3 nil="true"></option3>
    <position type="integer">2</position>
    <price type="decimal">199.00</price>
    <product-id type="integer">1706652214</product-id>
    <sku>IPOD2008RED</sku>
    <title>Red</title>
    <updated-at type="datetime">2009-10-20T07:28:51-04:00</updated-at>
  </variant>
  <variant>
    <compare-at-price type="decimal" nil="true"></compare-at-price>
    <created-at type="datetime">2009-10-20T07:28:51-04:00</created-at>
    <fulfillment-service>manual</fulfillment-service>
    <grams type="integer">200</grams>
    <id type="integer">1112814679</id>
    <inventory-management>shopify</inventory-management>
    <inventory-policy>continue</inventory-policy>
    <inventory-quantity type="integer">30</inventory-quantity>
    <option1>Green</option1>
    <option2 nil="true"></option2>
    <option3 nil="true"></option3>
    <position type="integer">3</position>
    <price type="decimal">199.00</price>
    <product-id type="integer">1706652214</product-id>
    <sku>IPOD2008GREEN</sku>
    <title>Green</title>
    <updated-at type="datetime">2009-10-20T07:28:51-04:00</updated-at>
  </variant>
  <variant>
    <compare-at-price type="decimal" nil="true"></compare-at-price>
    <created-at type="datetime">2009-10-20T07:28:51-04:00</created-at>
    <fulfillment-service>manual</fulfillment-service>
    <grams type="integer">200</grams>
    <id type="integer">457924702</id>
    <inventory-management>shopify</inventory-management>
    <inventory-policy>continue</inventory-policy>
    <inventory-quantity type="integer">40</inventory-quantity>
    <option1>Black</option1>
    <option2 nil="true"></option2>
    <option3 nil="true"></option3>
    <position type="integer">4</position>
    <price type="decimal">199.00</price>
    <product-id type="integer">1706652214</product-id>
    <sku>IPOD2008BLACK</sku>
    <title>Black</title>
    <updated-at type="datetime">2009-10-20T07:28:51-04:00</updated-at>
  </variant>
</variants>
top

Receive a count of all Product Variants

Get a count of product variants

GET /admin/products/#{id}/variants/count.xml

Count all variants for a product

Response

           
HTTP/1.1 200 OK
<?xml version="1.0" encoding="UTF-8"?>
<count type="integer">4</count>
top

Receive a single Product Variant

Get a single product variant by id

GET /admin/products/#{id}/variants/#{id}.xml

Get a product variant by id

Response

           
HTTP/1.1 200 OK
<?xml version="1.0" encoding="UTF-8"?>
<variant>
  <compare-at-price type="decimal" nil="true"></compare-at-price>
  <created-at type="datetime">2009-10-20T07:28:51-04:00</created-at>
  <fulfillment-service>manual</fulfillment-service>
  <grams type="integer">200</grams>
  <id type="integer">808950810</id>
  <inventory-management>shopify</inventory-management>
  <inventory-policy>continue</inventory-policy>
  <inventory-quantity type="integer">10</inventory-quantity>
  <option1>Pink</option1>
  <option2 nil="true"></option2>
  <option3 nil="true"></option3>
  <position type="integer">1</position>
  <price type="decimal">199.00</price>
  <product-id type="integer">1706652214</product-id>
  <sku>IPOD2008PINK</sku>
  <title>Pink</title>
  <updated-at type="datetime">2009-10-20T07:28:51-04:00</updated-at>
</variant>
top

Create a new Product Variant

Create a new product variant

POST /admin/products/#{id}/variants.xml

Create a new product variant

Request

           
<?xml version="1.0" encoding="UTF-8"?>
<variant>
  <price>1.00</price>
  <option1>Default</option1>
</variant>      

Response

           
HTTP/1.1 201 Created
<?xml version="1.0" encoding="UTF-8"?>
<variant>
  <compare-at-price type="decimal" nil="true"></compare-at-price>
  <created-at type="datetime">2009-10-20T07:29:17-04:00</created-at>
  <fulfillment-service>manual</fulfillment-service>
  <grams type="integer">0</grams>
  <id type="integer">1950891676</id>
  <inventory-management nil="true"></inventory-management>
  <inventory-policy>deny</inventory-policy>
  <inventory-quantity type="integer">1</inventory-quantity>
  <option1>Default</option1>
  <option2 nil="true"></option2>
  <option3 nil="true"></option3>
  <position type="integer">5</position>
  <price type="decimal">1.00</price>
  <product-id type="integer">1706652214</product-id>
  <sku></sku>
  <title>Default</title>
  <updated-at type="datetime">2009-10-20T07:29:17-04:00</updated-at>
</variant>
top

Modify an existing Product Variant

Update an existing product variant

PUT /admin/products/#{id}/variants/#{id}.xml

Update the inventory count an existing variant

Request

           
<?xml version="1.0" encoding="UTF-8"?>
<variant>
  <inventory-quantity type="integer">100</inventory-quantity>
  <id type="integer">808950810</id>
</variant>      

Response

           
HTTP/1.1 200 OK
<?xml version="1.0" encoding="UTF-8"?>
<variant>
  <compare-at-price type="decimal" nil="true"></compare-at-price>
  <created-at type="datetime">2009-10-20T07:28:51-04:00</created-at>
  <fulfillment-service>manual</fulfillment-service>
  <grams type="integer">200</grams>
  <id type="integer">808950810</id>
  <inventory-management>shopify</inventory-management>
  <inventory-policy>continue</inventory-policy>
  <inventory-quantity type="integer">100</inventory-quantity>
  <option1>Pink</option1>
  <option2 nil="true"></option2>
  <option3 nil="true"></option3>
  <position type="integer">1</position>
  <price type="decimal">199.00</price>
  <product-id type="integer">1706652214</product-id>
  <sku>IPOD2008PINK</sku>
  <title>Pink</title>
  <updated-at type="datetime">2009-10-20T07:29:29-04:00</updated-at>
</variant>
PUT /admin/products/#{id}/variants/#{id}.xml

Update the title and price of an existing variant

Request

           
<?xml version="1.0" encoding="UTF-8"?>
<variant>
  <price>99.00</price>
  <id type="integer">808950810</id>
  <option1>Not Pink</option1>
</variant>      

Response

           
HTTP/1.1 200 OK
<?xml version="1.0" encoding="UTF-8"?>
<variant>
  <compare-at-price type="decimal" nil="true"></compare-at-price>
  <created-at type="datetime">2009-10-20T07:28:51-04:00</created-at>
  <fulfillment-service>manual</fulfillment-service>
  <grams type="integer">200</grams>
  <id type="integer">808950810</id>
  <inventory-management>shopify</inventory-management>
  <inventory-policy>continue</inventory-policy>
  <inventory-quantity type="integer">10</inventory-quantity>
  <option1>Not Pink</option1>
  <option2 nil="true"></option2>
  <option3 nil="true"></option3>
  <position type="integer">1</position>
  <price type="decimal">99.00</price>
  <product-id type="integer">1706652214</product-id>
  <sku>IPOD2008PINK</sku>
  <title>Not Pink</title>
  <updated-at type="datetime">2009-10-20T07:29:32-04:00</updated-at>
</variant>
top

Remove a Product Variant from the database

DELETE /admin/products/#{id}/variants/#{id}.xml

Delete a product variant

Response

           
HTTP/1.1 200 OK
Last updated at Oct 2009 Oct:10 AM.