Skip to main content

Product Variant

Version: 1.0

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: com.read_products, com.write_products

What you can do with Product Variant

The Haravan API lets you do the following with the Product Variant resource.

Properties


barcode : string

"barcode": "123_pink"

The barcode, UPC or ISBN number for the product.

compare_at_price : number

"compare_at_price":  0.0000

The competitors prices for the same item.

created_at : string

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

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

fulfillment_service : string

"fulfillment_service": null

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

grams : number

"grams": 0.0000

The weight of the product variant in grams.

id : number

"id": 632910392

The unique numeric identifier for the product variant.

inventory_management : string

"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 : string

"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 variant when it's out of stock.

inventory_quantity : number

"inventory_quantity": 10

The number of items in stock for this product variant.

position : number

"position":1

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

price : number

"price": 100000.0000

The price of the product variant.

product_id : number

"product_id": 1034037268

The unique numeric identifier for the product.

requires_shipping: boolean

"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 : string

"sku":"IPOD2008PINK"

A unique identifier for the product in the shop.

taxable : boolean

"taxable":false

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

title : string

"title":"pink"

The title of the product variant.

updated_at : string

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

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

image_id : string

"image_id":null

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

option1: string

"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: string

"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:string

"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.

Retrieves a list of product variants

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

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

Parameters


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
Details
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
Details

HTTP/1.1 200 OK
{
"variants": [
{
"id": 1075012798,
"sku": "CSSWMHRJ",
"title": "Default Title",
"option1": "Default Title",
"option2": null,
"option3": null
}
]
}

Retrieve a count of the product variants

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

Retrieve the count of resources of the product variants.

  • GET https://apis.haravan.com/com/products/1034037268/variants/count.json
Details
HTTP/1.1 200 OK
{
"count": 2
}

Retrieves single the product variant

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

Retrieves single the product variant by ID.

  • GET https://apis.haravan.com/com/variants/1075012798.json
Details
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 variant

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

Create a new product variant.

  • POST https://apis.haravan.com/com/products/1034037268/variants.json
{
"variant": {
"sku":"CSSWWW",
"option1": "S",
"price": 100000
}
}
Details
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/{variant_id}.json

Update a product variant.

  • PUT https://apis.haravan.com/com/variants/1077703228.json
{
"variant": {
"sku":"CSSWWW",
"option1": "M",
"price": 200000
}
}
Details
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/{variant_id}.json

Delete a product variant.

  • DELETE https://apis.haravan.com/com/variants/1077703228.json
{}
Details
HTTP/1.1 200 OK
[]