variant
Properties
The compare at price of the variant in the currency's subunit.
The value is output in the customer's local (presentment) currency.
For currencies without subunits, such as JPY and KRW, tenths and hundredths of a unit are appended. For example, 1000 Japanese yen is output as 100000.
TipUse money filters to output a formatted price.
The image attached to the variant.
NoteThis is the same value as
variant.image
.Returns
true
if the variant has incoming inventory. Returnsfalse
if not.Incoming inventory information is populated by inventory transfers, purchase orders, and third-party apps.
The inventory management service of the variant.
If inventory isn't tracked, then
nil
is returned.Whether the variant should continue to be sold when it's out of stock.
TipTo learn about why merchants might want to continue selling products when they're out of stock, visit the Shopify Help Center.
Possible values Description continue Continue selling when the variant is out of stock. deny Stop selling when the variant is out of stock. The inventory quantity of the variant.
If inventory isn't tracked, then the number of items sold is returned.
Returns
true
if the variant has been matched by a storefront filter or no filters are applied. Returnsfalse
if it hasn't.- metafields
The metafields applied to the variant.
TipTo learn about how to create metafields, refer to Create and manage metafields or visit the Shopify Help Center.
The arrival date for the next incoming inventory of the variant.
Incoming inventory information is populated by inventory transfers, purchase orders, and third-party apps.
TipUse the
date
filter to format the date.- options
The values of the variant for each product option.
ExampleOutput the options of each variant{% for variant in product.variants -%}{%- capture options -%}{% for option in variant.options -%}{{ option }}{%- unless forloop.last -%}/{%- endunless -%}{%- endfor %}{%- endcapture -%}{{ variant.id }}: {{ options }}{%- endfor %}{% for variant in product.variants -%} {%- capture options -%} {% for option in variant.options -%} {{ option }}{%- unless forloop.last -%}/{%- endunless -%} {%- endfor %} {%- endcapture -%} {{ variant.id }}: {{ options }} {%- endfor %}
{ "product": { "variants": [ { "id": 39897499729985, "options": [ "S", "Low" ] }, { "id": 39897499762753, "options": [ "S", "Medium" ] }, { "id": 39897499795521, "options": [ "S", "High" ] }, { "id": 39897499828289, "options": [ "M", "Low" ] }, { "id": 39897499861057, "options": [ "M", "Medium" ] }, { "id": 39897499893825, "options": [ "M", "High" ] }, { "id": 39897499926593, "options": [ "L", "Low" ] }, { "id": 39897499959361, "options": [ "L", "Medium" ] }, { "id": 39897499992129, "options": [ "L", "High" ] } ] } }
Output
39897499729985: S/Low39897499762753: S/Medium39897499795521: S/High39897499828289: M/Low39897499861057: M/Medium39897499893825: M/High39897499926593: L/Low39897499959361: L/Medium39897499992129: L/HighThe price of the variant in the currency's subunit.
The value is output in the customer's local (presentment) currency.
For currencies without subunits, such as JPY and KRW, tenths and hundredths of a unit are appended. For example, 1000 Japanese yen is output as 100000.
TipUse money filters to output a formatted price.
- quantity_
price_ breaks array of quantity_price_break Returns
objects for the variant in the current customer context.
Returns
true
if the variant has any quantity price breaks available in the current customer context. Returnsfalse
if it doesn't.- quantity_
rule The quantity rule for the variant.
If no rule exists, then a default value is returned.
This rule can be set as part of a B2B catalog.
NoteThe default quantity rule is
min=1,max=null,increment=1
.Returns
true
if the variant's product is set to require awhen being added to the cart. Returns
false
if not.Returns
true
if the variant requires shipping. Returnsfalse
if it doesn't.Returns
true
if the variant is currently selected. Returnsfalse
if it's not.NoteThe selected variant is determined by the
variant
URL parameter. This URL parameter is available on product pages URLs only.- selected_
selling_ plan_ allocation The selected
.
If no selling plan is selected, then
nil
is returned.NoteThe selected selling plan is determined by the
URL parameter.
- selling_
plan_ allocations array of selling_plan_allocation The
objects for the variant.
- store_
availabilities array of store_availability The store availabilities for the variant.
The array is defined in only the following cases:
variant.selected
istrue
- The variant is the product's first available variant. For example,
or
.
Returns
true
if taxes should be charged on the variant. Returnsfalse
if not.A concatenation of each variant option, separated by a
/
.ExampleThe variant title{{ product.variants.first.title }}{{ product.variants.first.title }}
{ "product": { "variants": [ { "title": "S / Low" }, { "title": "S / Medium" }, { "title": "S / High" }, { "title": "M / Low" }, { "title": "M / Medium" }, { "title": "M / High" }, { "title": "L / Low" }, { "title": "L / Medium" }, { "title": "L / High" } ] } }
Output
S / LowThe unit price of the variant in the currency's subunit.
The price reflects any discounts that are applied to the line item. The value is output in the customer's local (presentment) currency.
For currencies without subunits, such as JPY and KRW, tenths and hundredths of a unit are appended. For example, 1000 Japanese yen is output as 100000.
NoteUnit prices are available only to stores located in the European Union or Switzerland.
TipUse the
filter with this property and the
property to output a formatted unit price with measurement.
To learn about how to display unit prices in your theme, refer to Unit pricing.
- unit_
price_ measurement The unit price measurement of the variant.
NoteUnit prices are available only to stores located in the European Union or Switzerland.
To learn about how to display unit prices in your theme, refer to Unit pricing.
TipUse the
filter with the
property and this property to output a formatted unit price with measurement.
The URL of the variant.
Variant URLs use the following structure:
/products/[product-handle]?variant=[variant-id]
The weight of the variant in grams.
TipUse the
filter to format the weight in the store's format.
Use
to output the weight in the unit configured on the variant.
The weight of the variant in the unit specified by
.
TipTo output this weight, use this property, and the
property, with the
filter.
Deprecated Properties
The value of the variant for the first product option.
If there's no first product option, then
nil
is returned.DeprecatedDeprecated. Prefer to use
variant.options
instead.The value of the variant for the second product option.
If there's no second product option, then
nil
is returned.DeprecatedDeprecated. Prefer to use
variant.options
instead.The value of the variant for the third product option.
If there's no third product option, then
nil
is returned.DeprecatedDeprecated. Prefer to use
variant.options
instead.
{
"available": true,
"barcode": "",
"compare_at_price": null,
"featured_image": null,
"featured_media": null,
"id": 39897499729985,
"image": null,
"incoming": false,
"inventory_management": "shopify",
"inventory_policy": "deny",
"inventory_quantity": 5,
"matched": true,
"metafields": {},
"next_incoming_date": null,
"option1": "S",
"option2": "Low",
"option3": null,
"options": [],
"price": "10.00",
"product": {},
"quantity_price_breaks": [],
"quantity_rule": {},
"requires_selling_plan": false,
"requires_shipping": true,
"selected": false,
"selected_selling_plan_allocation": null,
"selling_plan_allocations": [],
"sku": "",
"store_availabilities": [],
"taxable": true,
"title": "S / Low",
"unit_price": null,
"unit_price_measurement": null,
"url": {},
"weight": 500,
"weight_in_unit": 500,
"weight_unit": "g"
}