---
title: "productVariants"
description: "Retrieve the list of product variants."
doc_type: graphql
doc_category: adminGraphQL
doc_version: v20270301
source_url:
  html: 'https://developer.shopline.com/docs/admin-graph-ql-api/products-and-collections/queries/product-variants'
  md: 'https://developer.shopline.com/docs/admin-graph-ql-api/products-and-collections/queries/product-variants.md'
---
# productVariants

Retrieve the list of product variants.

- **API Version:** v20270301
- **API Type:** Admin
- **API Protocol:** GraphQL
- **Operation Type:** Query

## Type Signature

`ProductVariantConnection`

## Arguments

* `sortKey`

  [ProductVariantSortKeys](https://developer.shopline.com/docs/admin-graph-ql-api/products-and-collections/enums/product-variant-sort-keys.md)

  Order the base list in ascending manner using the specified sort key.

* `after`

  [String](https://developer.shopline.com/docs/admin-graph-ql-api/common/scalars/string.md)

  Returns elements following the specified cursor. The `first` argument must also be specified when using this argument.

* `before`

  [String](https://developer.shopline.com/docs/admin-graph-ql-api/common/scalars/string.md)

  Returns elements preceding the specified cursor. The `last` argument must also be specified when using this argument.

* `first`

  [Int](https://developer.shopline.com/docs/admin-graph-ql-api/common/scalars/int.md)

  Returns the first n elements in the list. 

* `last`

  [Int](https://developer.shopline.com/docs/admin-graph-ql-api/common/scalars/int.md)

  Returns the last n elements in the list. 

* `reverse`

  [Boolean](https://developer.shopline.com/docs/admin-graph-ql-api/common/scalars/boolean.md)

  Whether to reverse the order of the list. 
  
  ● true: reverse
  
  ● false: do not reverse
  
  Default value: false

* `query`

  [String](https://developer.shopline.com/docs/admin-graph-ql-api/common/scalars/string.md)

  Use one or more filters for the query. 
  
  | parameter | description |
  | --- | --- |
  | barcode | The barcode value linked to the product.  |
  | collection | The ID of the collection. |
  | gift_card | Specify if the product is a gift card item (boolean value passed).  |
  | inventory_quantity | Product variant's available inventory.  |
  | location_id | The ID of the location |
  | option1 | The 1st option value of the product variant |
  | option2 | The 2nd option value of the product variant |
  | option3 | The 3rd option value of the product variant |
  | option4 | The 4th option value of the product variant |
  | option5 | The 5th option value of the product variant |
  | product_ids | The ID of the product (currently does not support passing in multiple IDs) |
  | product_status | The product's status. |
  | product_type | A product type customized by the merchant. |
  | sku | The SKU of the product variant, a case-sensitive string. |
  | tag | The tags associated with the product. |
  | taxable | Whether the variant is taxed when sold (boolean value passed). |
  | title | The product's title. |
  | updated_at | The last modified date and time of the product variant. |
  | vendor | The vendor name of the product.  |
  | spu | The product's SPU code. |
  
  :::tip{title="tip"}
  The current supports a maximum of 5 parameters. Optimizations will be implemented in the future.
  :::
  
  #### Grammar reference
  
  ```js
  title:'test' AND inventory_quantity:>=1000
  
  ```
  

## Returns

* `edges`

  [[ProductVariantEdge!]](https://developer.shopline.com/docs/admin-graph-ql-api/products-and-collections/objects/product-variant-edge.md)

  List of edge nodes.

* `pageInfo`

  [PageInfo!](https://developer.shopline.com/docs/admin-graph-ql-api/common-objects/objects/page-info.md)

  Pagination Assistance Information.

## Code Example

```graphql
 {
	productVariants(sortKey, after, before, first, last, reverse, query ) 
		 {
			# ProductVariantConnection fields
		}
}
```

## Error Handling

For detailed information about common codes, see [Status and error codes](https://developer.shopline.com/docs/apps/api-instructions-for-use/graph-ql-admin-api/overview.md#status-and-error-codes).

