productVariants
QueryRetrieves a paged list of product variants with optional filtering, sorting, and full-text search capabilities.
Arguments
- String
after Returns the elements in the list that come after the specified cursor.
- String
before Returns the elements in the list that come before the specified cursor.
- Int
first Returns the first n elements from the list.
- Int
last Returns the last n elements from the list.
- String
query - A filter expression made up of terms, boolean operators, modifiers, and comparators. Combine one or more filters in a single query.
Available filters17
defaultstringSearches indexed variant and parent-product text such as names, SKUs, barcodes, vendors, and tags. Every term must match.
ExamplesLAMP-01 blue"Blue Large"idIDMatches a product variant by its unique identifier.
Exampleid:vid_...namestringMatches the variant name. Phrases and prefix wildcards are supported.
Examplesname:"Blue / Large"name:blu*skustringMatches the variant SKU.
Examplesku:LAMP-01-BLUEbarcodestringMatches the variant barcode.
Examplebarcode:5712345678901statusstringMatches the variant's lifecycle status.
Examplestatus:activeproduct.idIDMatches variants belonging to the specified product.
Exampleproduct.id:product_...product.namestringMatches the parent product name.
Exampleproduct.name:"Portable Lamp"product.vendorstringMatches the parent product vendor.
Exampleproduct.vendor:acmeproduct.tagsstringMatches a tag assigned to the parent product.
Exampleproduct.tags:lightingproduct.categoriesIDMatches variants whose parent product is assigned to the specified category.
Exampleproduct.categories:cat_...product.collectionsIDMatches variants whose parent product is assigned to the specified collection.
Exampleproduct.collections:col_...metadata.<key>stringMatches, prefix-matches, or checks for an indexed metadata value.
Examplesmetadata.import_source:erpmetadata.import_source:*metafields.<namespace>.<key>string | numberMatches a public variant metafield value, checks for its presence, or compares a numeric value.
Examplesmetafields.specs.material:oakmetafields.specs.wattage:>=40product.metafields.<namespace>.<key>string | numberMatches an indexed public metafield on the parent product.
Exampleproduct.metafields.specs.material:oakattributes.<attribute-name>stringMatches a variant attribute value.
Exampleattributes.color:blueavailable_for_salebooleanMatches variants that are or are not available for sale in the current request context.
Exampleavailable_for_sale:true
- SortDirection
sortDirection The sort direction.
Possible enum valuesASCOrders values from lowest to highest or alphabetically from A to Z.
DESCOrders values from highest to lowest or alphabetically from Z to A.
- ProductVariantSortKeys
sortKey The field by which to sort the variants. Supported values include:
Possible enum valuesIDOrders variants by their identifier.
NAMEOrders variants alphabetically by name.
SKUOrders variants alphanumerically by SKU.
Payload
- [ProductVariantEdge!]
edges A list of edges.
- [ProductVariant!]
nodes A flattened list of the nodes
- PageInfo!
pageInfo Information to aid in pagination.
- Int!
totalCount Identifies the total count of items in the connection.