A product variant is a different version of a product, such as differing sizes or differing colours. Without product variants, you would have to treat the small, medium and large versions of a t-shirt as three separate products; product variants let you treat the small, medium and large versions of a t-shirt as variations of the same product.

Each product can have a maximum of 100 variants.

Authenticated access scopes: read_products, write_products

Product variant properties

barcode

"barcode": "123_pink"

The barcode, UPC or ISBN number for the product.

compare_at_price

"compare_at_price":  0.0000

The competitors prices for the same item.

created_at

"created_at": "2021-05-13T07:29:20.1Z"

The date and time (ISO 8601 format) when the product variant was created.

fulfillment_service

"fulfillment_service": null

Service who is doing the fulfillment. Valid values are: null.

grams

"fulfillment_service": 0.0000

The weight of the product variant in grams.

id

"id": 632910392

The unique numeric identifier for the product variant.

inventory_management

"inventory_management": "haravan"

Specifies whether or not haravan tracks the number of items in stock for this product variant. Valid values are:

  • blank: haravan does not track the number of items in stock for this product variant.
  • haravan: haravan does track the number of items in stock for this product variant.

inventory_policy

"inventory_policy": "continue"

Specifies whether or not customers are allowed to place an order for a product variant when it's out of stock. Valid values are:

  • deny (default): Customers are not allowed to place orders for a product variant when it's out of stock.
  • continue: Customers are allowed to place orders for a product variatn when it's out of stock.

inventory_quantity

"inventory_quantity": 10

The number of items in stock for this product variant.

position

"position":1

The order of the product variant in the list of product variants. 1 is the first position.

price

"price": 100000.0000

The price of the product variant.

product_id

"product_id": 1034037268

The unique numeric identifier for the product.

requires_shipping

"requires_shipping": true

Specifies whether or not a customer needs to provide a shipping address when placing an order for this product variant. Valid values are:

  • true: Customer needs to supply a shipping address.
  • false: Customer does not need to supply a shipping address.

sku

"sku":"IPOD2008PINK"

A unique identifier for the product in the shop.

taxable

"taxable":false

Specifies whether or not a tax is charged when the product variant is sole.

title

"title":"pink"

The title of the product variant.

updated_at

"updated_at": "2021-05-13T07:29:20.1Z"

The date and time (ISO 8601 format) when the product variant was updated.

image_id

"image_id":null

The unique numeric identifier for one of the product's images.

option1

"option1":size

Custom properties that a shop owner can use to define product variants. Multiple options can exist. Options are represented as: option1, option2, option3 etc.

option2

"option2":null

Custom properties that a shop owner can use to define product variants. Multiple options can exist. Options are represented as: option1, option2, option3 etc.

option3

"option3":null

Custom properties that a shop owner can use to define product variants. Multiple options can exist. Options are represented as: option1, option2, option3 etc.

Endpoints

GET https://apis.haravan.com/com/products/{product_id}/variants.json 

Retrieves a list of product variants. You can filter resources by params.

ids

A comma-separated list of product ids.

limit

Limit of the result.

page

Page to show the result.

since_id

Restrict results to after the specified ID

fields

comma-separated list of fields to include in the response.

Retrieve all product variants by page number. By default, the number of resources on the page is 50.

GET https://apis.haravan.com/com/products/1034037268/variants.json?page=1

View Response

				

HTTP/1.1 200 OK

{ "variants": [ { "barcode": "CSSWMHRJ", "compare_at_price": 0.0000, "created_at": "2021-06-28T06:15:57.554Z", "fulfillment_service": null, "grams": 0.0000, "id": 1075012798, "inventory_management": "haravan", "inventory_policy": "deny", "inventory_quantity": 0, "position": 0, "price": 9990000.0000, "product_id": 1034037268, "requires_shipping": true, "sku": "CSSWMHRJ", "taxable": false, "title": "Default Title", "updated_at": "2021-08-14T07:50:52.173Z", "image_id": null, "option1": "Size", "option2": null, "option3": null, "inventory_advance": null } ] }

Retrieve a list of specific product variants.

GET https://apis.haravan.com/com/products/1034037268/variants.json?fields=sku,title,option1,option2,option3

View Response

HTTP/1.1 200 OK
{
    "variants": [
        {
            "id": 1075012798,
            "sku": "CSSWMHRJ",
            "title": "Default Title",
            "option1": "Default Title",
            "option2": null,
            "option3": null
        }
    ]
}
GET https://apis.haravan.com/com/products/{product_id}/variants/count.json 

Retrieve the count of resources of the product variants.

Retrieve the count of resources of the product variants.

GET https://apis.haravan.com/com/products/1034037268/variants/count.json

View Response

HTTP/1.1 200 OK
				
{
    "count"2
}
GET https://apis.haravan.com/com/variants/{variant_id}.json 

Retrieves single the product variant.

Retrieves single the product variant by ID.

GET https://apis.haravan.com/com/variants/1075012798.json

View Response

				

HTTP/1.1 200 OK

{ "variant": { "barcode": "CSSWMHRJ", "compare_at_price": 0.0000, "created_at": "2021-06-28T06:15:57.554Z", "fulfillment_service": null, "grams": 0.0000, "id": 1075012798, "inventory_management": "haravan", "inventory_policy": "deny", "inventory_quantity": 0, "position": 0, "price": 9990000.0000, "product_id": 1034037268, "requires_shipping": true, "sku": "CSSWMHRJ", "taxable": false, "title": "Default Title", "updated_at": "2021-08-14T07:50:52.173Z", "image_id": null, "option1": "Default Title", "option2": null, "option3": null, "inventory_advance": null } }

Create a new product.

POST https://apis.haravan.com/com/products/1034037268.json

{
  "variant": {
    "sku":"CSSWWW",
    "option1": "S",
    "price": 100000
  }
}

View Response

                

HTTP/1.1 201 Created

{ "variant": { "barcode": null, "compare_at_price": 0.0000, "created_at": "2021-09-07T10:51:59.267Z", "fulfillment_service": null, "grams": 0.0000, "id": 1077703228, "inventory_management": null, "inventory_policy": "deny", "inventory_quantity": 1, "old_inventory_quantity": 1, "inventory_quantity_adjustment": null, "position": 0, "price": 100000.0000, "product_id": 1034037268, "requires_shipping": false, "sku": "CSSWWW", "taxable": false, "title": "S", "updated_at": "2021-09-07T10:51:59.267Z", "image_id": null, "option1": "S", "option2": "", "option3": "", "inventory_advance": null } }

Update a product variant.

PUT https://apis.haravan.com/com/variants/1077703228.json

{
  "variant": {
    "sku":"CSSWWW",
    "option1": "M",
    "price": 200000
  }
}

View Response

                

HTTP/1.1 200 OK

{ "variant": { "barcode": null, "compare_at_price": 0.0000, "created_at": "2021-09-07T10:51:59.267Z", "fulfillment_service": null, "grams": 0.0000, "id": 1077703228, "inventory_management": null, "inventory_policy": "deny", "inventory_quantity": 1, "old_inventory_quantity": 1, "inventory_quantity_adjustment": null, "position": 0, "price": 200000.0000, "product_id": 1034037268, "requires_shipping": false, "sku": "CSSWWW", "taxable": false, "title": "M", "updated_at": "2021-09-07T10:56:37.989Z", "image_id": null, "option1": "M", "option2": "", "option3": "", "inventory_advance": null } }

Delete a product variant.

DELETE https://apis.haravan.com/com/variants/1077703228.json

{}

View Response

                

HTTP/1.1 200 OK

[]