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.
Tip:Use money filters to output a formatted price.
Tip: Use <a href="/docs/api/liquid/filters/money-filters">money filters</a> to output a formatted price.
The image attached to the variant.
NoteThis is the same value as
variant.image.Note:This is the same value as
variant.image.Note: This is the same value as <a href="/docs/api/liquid/objects/variant#variant-image"><code>variant.image</code></a>.
The image attached to the variant.
Returns
trueif the variant has incoming inventory. Returnsfalseif 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
nilis 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.
Tip:To learn about why merchants might want to continue selling products when they're out of stock, visit the Shopify Help Center.
Tip: To learn about why merchants might want to continue selling products when they're out of stock, visit the <a href="https://help.shopify.com/manual/products/inventory/getting-started-with-inventory/selling-when-out-of-stock">Shopify Help Center</a>.
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
trueif the variant has been matched by a storefront filter or no filters are applied. Returnsfalseif it hasn't.- metafieldsmetafields
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.
Tip:To learn about how to create metafields, refer to Create and manage metafields or visit the Shopify Help Center.
Tip: To learn about how to create metafields, refer to <a href="/apps/metafields/manage">Create and manage metafields</a> or visit the <a href="https://help.shopify.com/manual/metafields">Shopify Help Center</a>.
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
datefilter to format the date.Tip:Use the
datefilter to format the date.Tip: Use the <a href="/docs/api/liquid/filters/date"><code>date</code> filter</a> to format the date.
- optionsoptions
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 %}Code
{% for variant in product.variants -%} {%- capture options -%} {% for option in variant.options -%} {{ option }}{%- unless forloop.last -%}/{%- endunless -%} {%- endfor %} {%- endcapture -%} {{ variant.id }}: {{ options }} {%- endfor %}Data
{ "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/HighOutput
39897499729985: S/Low 39897499762753: S/Medium 39897499795521: S/High 39897499828289: M/Low 39897499861057: M/Medium 39897499893825: M/High 39897499926593: L/Low 39897499959361: L/Medium 39897499992129: 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.
Tip:Use money filters to output a formatted price.
Tip: Use <a href="/docs/api/liquid/filters/money-filters">money filters</a> to output a formatted price.
- quantity_
price_ breaksquantity_ price_ breaks array of quantity_price_break Returns
objects for the variant in the current customer context.Returns
trueif the variant has any quantity price breaks available in the current customer context. Returnsfalseif it doesn't.- quantity_
rulequantity_ 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.Note:The default quantity rule is
min=1,max=null,increment=1.Note: The default quantity rule is <code>min=1,max=null,increment=1</code>.
Returns
trueif the variant's product is set to require awhen being added to the cart. Returnsfalseif not.Returns
trueif the variant requires shipping. Returnsfalseif it doesn't.Returns
trueif the variant is currently selected. Returnsfalseif it's not.NoteThe selected variant is determined by the
variantURL parameter. This URL parameter is available on product pages URLs only.Note:The selected variant is determined by the
variantURL parameter. This URL parameter is available on product pages URLs only.Note: The selected variant is determined by the <code>variant</code> URL parameter. This URL parameter is available on product pages URLs only.
- selected_
selling_ plan_ allocationselected_ selling_ plan_ allocation The selected
.If no selling plan is selected, then
nilis returned.NoteThe selected selling plan is determined by the
URL parameter.Note:The selected selling plan is determined by the
URL parameter.Note: The selected selling plan is determined by the <code><span class="PreventFireFoxApplyingGapToWBR">selling<wbr/>_plan</span></code> URL parameter.
- selling_
plan_ allocationsselling_ plan_ allocations array of selling_plan_allocation The
objects for the variant.- store_
availabilitiesstore_ availabilities array of store_availability The store availabilities for the variant.
The array is defined in only the following cases:
variant.selectedistrue- The variant is the product's first available variant. For example,
or.
Returns
trueif taxes should be charged on the variant. Returnsfalseif not.A concatenation of each variant option, separated by a
/.ExampleThe variant title{{ product.variants.first.title }}Code
{{ product.variants.first.title }}Data
{ "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 / LowOutput
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.
TipUse the
filter with this property and theproperty to output a formatted unit price with measurement.Tip:Use the
filter with this property and theproperty to output a formatted unit price with measurement.Tip: Use the <a href="/docs/api/liquid/filters/unit_price_with_measurement"><code><span class="PreventFireFoxApplyingGapToWBR">unit<wbr/>_price<wbr/>_with<wbr/>_measurement</span></code> filter</a> with this property and the <code><span class="PreventFireFoxApplyingGapToWBR">variant.unit<wbr/>_price<wbr/>_measurement</span></code> 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_ measurementunit_ price_ measurement The unit price measurement of the variant.
To learn about how to display unit prices in your theme, refer to Unit pricing.
TipUse the
filter with theproperty and this property to output a formatted unit price with measurement.Tip:Use the
filter with theproperty and this property to output a formatted unit price with measurement.Tip: Use the <a href="/docs/api/liquid/filters/unit_price_with_measurement"><code><span class="PreventFireFoxApplyingGapToWBR">unit<wbr/>_price<wbr/>_with<wbr/>_measurement</span></code> filter</a> with the <code><span class="PreventFireFoxApplyingGapToWBR">variant.unit<wbr/>_price</span></code> 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.Tip:Use the
filter to format the weight in the store's format.Use
to output the weight in the unit configured on the variant.Tip: Use the <a href="/docs/api/liquid/filters/weight_with_unit"><code><span class="PreventFireFoxApplyingGapToWBR">weight<wbr/>_with<wbr/>_unit</span></code></a> filter to format the weight in <a href="https://www.shopify.com/admin/settings/general">the store's format</a>.</p> <p>Use <code><span class="PreventFireFoxApplyingGapToWBR">variant.weight<wbr/>_in<wbr/>_unit</span></code> 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 thefilter.Tip:To output this weight, use this property, and the
property, with thefilter.Tip: To output this weight, use this property, and the <code><span class="PreventFireFoxApplyingGapToWBR">variant.weight<wbr/>_unit</span></code> property, with the <a href="/docs/api/liquid/filters/weight_with_unit"><code><span class="PreventFireFoxApplyingGapToWBR">weight<wbr/>_with<wbr/>_unit</span></code> filter</a>.
The unit for the weight of the variant.
TipTo output the weight of a variant in this unit, use this property, and the
property, with thefilter.Tip:To output the weight of a variant in this unit, use this property, and the
property, with thefilter.Tip: To output the weight of a variant in this unit, use this property, and the <code><span class="PreventFireFoxApplyingGapToWBR">variant.weight<wbr/>_in<wbr/>_unit</span></code> property, with the <a href="/docs/api/liquid/filters/weight_with_unit"><code><span class="PreventFireFoxApplyingGapToWBR">weight<wbr/>_with<wbr/>_unit</span></code> filter</a>.
Deprecated Properties
The value of the variant for the first product option.
If there's no first product option, then
nilis returned.DeprecatedDeprecated. Prefer to use
variant.optionsinstead.Deprecated:Deprecated. Prefer to use
variant.optionsinstead.The value of the variant for the second product option.
If there's no second product option, then
nilis returned.DeprecatedDeprecated. Prefer to use
variant.optionsinstead.Deprecated:Deprecated. Prefer to use
variant.optionsinstead.The value of the variant for the third product option.
If there's no third product option, then
nilis returned.DeprecatedDeprecated. Prefer to use
variant.optionsinstead.Deprecated:Deprecated. Prefer to use
variant.optionsinstead.
Example
{
"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"
}