--- title: "Liquid objects: variant" description: A [product variant](https://help.shopify.com/manual/products/variants). api_name: liquid source_url: html: https://shopify.dev/docs/api/liquid/objects/variant md: https://shopify.dev/docs/api/liquid/objects/variant.md --- # variant A [product variant](https://help.shopify.com/manual/products/variants). ## Properties * * available [boolean](https://shopify.dev/docs/api/liquid/basics#boolean) * Returns `true` if the variant is available. Returns `false` if not. * barcode [string](https://shopify.dev/docs/api/liquid/basics#string) * The barcode of the variant. * compare\_​at\_​price [number](https://shopify.dev/docs/api/liquid/basics#number) * 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. Tip Use [money filters](https://shopify.dev/docs/api/liquid/filters/money-filters) to output a formatted price. * featured\_​image [image](https://shopify.dev/docs/api/liquid/objects/image) * The image attached to the variant. Note This is the same value as [`variant.image`](https://shopify.dev/docs/api/liquid/objects/variant#variant-image). * featured\_​media [media](https://shopify.dev/docs/api/liquid/objects/media) * The first media object attached to the variant. * id [number](https://shopify.dev/docs/api/liquid/basics#number) * The ID of the variant. * image [image](https://shopify.dev/docs/api/liquid/objects/image) * The image attached to the variant. Note This is the same value as [`variant.featured_image`](https://shopify.dev/docs/api/liquid/objects/variant#variant-featured_image). * incoming [boolean](https://shopify.dev/docs/api/liquid/basics#boolean) * Returns `true` if the variant has incoming inventory. Returns `false` if not. Incoming inventory information is populated by [inventory transfers](https://help.shopify.com/manual/products/inventory/transfers), [purchase orders](https://help.shopify.com/manual/products/inventory/purchase-orders), and [third-party apps](https://shopify.dev/docs/apps/fulfillment/inventory-management-apps). * inventory\_​management [string](https://shopify.dev/docs/api/liquid/basics#string) * The inventory management service of the variant. If inventory isn't tracked, then `nil` is returned. * inventory\_​policy [string](https://shopify.dev/docs/api/liquid/basics#string) from a set of values * Whether the variant should continue to be sold when it's out of stock. Tip To learn about why merchants might want to continue selling products when they're out of stock, visit the [Shopify Help Center](https://help.shopify.com/manual/products/inventory/getting-started-with-inventory/selling-when-out-of-stock). | Possible values | Description | | - | - | | continue | Continue selling when the variant is out of stock. | | deny | Stop selling when the variant is out of stock. | * inventory\_​quantity [number](https://shopify.dev/docs/api/liquid/basics#number) * The inventory quantity of the variant. If inventory isn't tracked, then the number of items sold is returned. * matched [boolean](https://shopify.dev/docs/api/liquid/basics#boolean) * Returns `true` if the variant has been matched by a [storefront filter](https://shopify.dev/themes/navigation-search/filtering/storefront-filtering) or no filters are applied. Returns `false` if it hasn't. * metafields * The [metafields](https://shopify.dev/docs/api/liquid/objects/metafield) applied to the variant. Tip To learn about how to create metafields, refer to [Create and manage metafields](https://shopify.dev/apps/metafields/manage) or visit the [Shopify Help Center](https://help.shopify.com/manual/metafields). * next\_​incoming\_​date [string](https://shopify.dev/docs/api/liquid/basics#string) * The arrival date for the next incoming inventory of the variant. Incoming inventory information is populated by [inventory transfers](https://help.shopify.com/manual/products/inventory/transfers), [purchase orders](https://help.shopify.com/manual/products/inventory/purchase-orders), and [third-party apps](https://shopify.dev/docs/apps/fulfillment/inventory-management-apps). Tip Use the [`date` filter](https://shopify.dev/docs/api/liquid/filters/date) to format the date. * options [product\_option\_value](https://shopify.dev/docs/api/liquid/objects/product_option_value) * The values of the variant for each [product option](https://shopify.dev/docs/api/liquid/objects/product_option). ![](https://shopify.dev/images/icons/32/lightbulbscroll.png)![](https://shopify.dev/images/icons/32/lightbulbscroll-dark.png)ExampleOutput the options of each variant ```liquid {% for variant in product.variants -%} {%- capture options -%} {% for option in variant.options -%} {{ option }}{%- unless forloop.last -%}/{%- endunless -%} {%- endfor %} {%- endcapture -%} {{ variant.id }}: {{ options }} {%- endfor %} ``` ## Output ```html 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/High ``` * price [number](https://shopify.dev/docs/api/liquid/basics#number) * The 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. Tip Use [money filters](https://shopify.dev/docs/api/liquid/filters/money-filters) to output a formatted price. * product [product](https://shopify.dev/docs/api/liquid/objects/product) * The parent product of the variant. * quantity\_​price\_​breaks array of [quantity\_price\_break](https://shopify.dev/docs/api/liquid/objects/quantity_price_break) * Returns `quantity_price_break` objects for the variant in the current customer context. * quantity\_​price\_​breaks\_​configured? [boolean](https://shopify.dev/docs/api/liquid/basics#boolean) * Returns `true` if the variant has any quantity price breaks available in the current customer context. Returns `false` if it doesn't. * quantity\_​rule [quantity\_rule](https://shopify.dev/docs/api/liquid/objects/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](https://help.shopify.com/manual/b2b/catalogs/quantity-pricing). Note The default quantity rule is `min=1,max=null,increment=1`. * requires\_​selling\_​plan [boolean](https://shopify.dev/docs/api/liquid/basics#boolean) * Returns `true` if the variant's product is set to require a `selling_plan` when being added to the cart. Returns `false` if not. * requires\_​shipping [boolean](https://shopify.dev/docs/api/liquid/basics#boolean) * Returns `true` if the variant requires shipping. Returns `false` if it doesn't. * selected [boolean](https://shopify.dev/docs/api/liquid/basics#boolean) * Returns `true` if the variant is currently selected. Returns `false` if it's not. Note The selected variant is determined by the `variant` URL parameter. This URL parameter is available on product pages URLs only. * selected\_​selling\_​plan\_​allocation [selling\_plan\_allocation](https://shopify.dev/docs/api/liquid/objects/selling_plan_allocation) * The selected `selling_plan_allocation`. If no selling plan is selected, then `nil` is returned. Note The selected selling plan is determined by the `selling_plan` URL parameter. * selling\_​plan\_​allocations array of [selling\_plan\_allocation](https://shopify.dev/docs/api/liquid/objects/selling_plan_allocation) * The `selling_plan_allocation` objects for the variant. * sku [string](https://shopify.dev/docs/api/liquid/basics#string) * The SKU of the variant. * store\_​availabilities array of [store\_availability](https://shopify.dev/docs/api/liquid/objects/store_availability) * The store availabilities for the variant. The array is defined in only the following cases: * `variant.selected` is `true` * The variant is the product's first available variant. For example, `product.first_available_variant` or `product.selected_or_first_available_variant`. * taxable [boolean](https://shopify.dev/docs/api/liquid/basics#boolean) * Returns `true` if taxes should be charged on the variant. Returns `false` if not. * title [string](https://shopify.dev/docs/api/liquid/basics#string) * A concatenation of each variant option, separated by a `/`. ![](https://shopify.dev/images/icons/32/lightbulbscroll.png)![](https://shopify.dev/images/icons/32/lightbulbscroll-dark.png)ExampleThe variant title ```liquid {{ product.variants.first.title }} ``` ## Output ```html S / Low ``` * unit\_​price [number](https://shopify.dev/docs/api/liquid/basics#number) * The [unit price](https://help.shopify.com/manual/products/details/product-pricing/unit-pricing#add-unit-prices-to-your-product) 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. Tip Use the [`unit_price_with_measurement` filter](https://shopify.dev/docs/api/liquid/filters/unit_price_with_measurement) with this property and the `variant.unit_price_measurement` property to output a formatted unit price with measurement. To learn about how to display unit prices in your theme, refer to [Unit pricing](https://shopify.dev/themes/pricing-payments/unit-pricing). * unit\_​price\_​measurement [unit\_price\_measurement](https://shopify.dev/docs/api/liquid/objects/unit_price_measurement) * The unit price measurement of the variant. To learn about how to display unit prices in your theme, refer to [Unit pricing](https://shopify.dev/themes/pricing-payments/unit-pricing). Tip Use the [`unit_price_with_measurement` filter](https://shopify.dev/docs/api/liquid/filters/unit_price_with_measurement) with the `variant.unit_price` property and this property to output a formatted unit price with measurement. * url [string](https://shopify.dev/docs/api/liquid/basics#string) * The URL of the variant. Variant URLs use the following structure: ``` /products/[product-handle]?variant=[variant-id] ``` * weight [number](https://shopify.dev/docs/api/liquid/basics#number) * The weight of the variant in grams. Tip Use the [`weight_with_unit`](https://shopify.dev/docs/api/liquid/filters/weight_with_unit) filter to format the weight in [the store's format](https://www.shopify.com/admin/settings/general). Use `variant.weight_in_unit` to output the weight in the unit configured on the variant. * weight\_​in\_​unit [number](https://shopify.dev/docs/api/liquid/basics#number) * The weight of the variant in the unit specified by `variant.weight_unit`. Tip To output this weight, use this property, and the `variant.weight_unit` property, with the [`weight_with_unit` filter](https://shopify.dev/docs/api/liquid/filters/weight_with_unit). * weight\_​unit [string](https://shopify.dev/docs/api/liquid/basics#string) * The unit for the weight of the variant. Tip To output the weight of a variant in this unit, use this property, and the `variant.weight_in_unit` property, with the [`weight_with_unit` filter](https://shopify.dev/docs/api/liquid/filters/weight_with_unit). ## Deprecated Properties * * option1 [string](https://shopify.dev/docs/api/liquid/basics#string) Deprecated * The value of the variant for the first product option. If there's no first product option, then `nil` is returned. Deprecated Deprecated. Prefer to use [`variant.options`](https://shopify.dev/docs/api/liquid/objects/variant#variant-options) instead. * option2 [string](https://shopify.dev/docs/api/liquid/basics#string) Deprecated * The value of the variant for the second product option. If there's no second product option, then `nil` is returned. Deprecated Deprecated. Prefer to use [`variant.options`](https://shopify.dev/docs/api/liquid/objects/variant#variant-options) instead. * option3 [string](https://shopify.dev/docs/api/liquid/basics#string) Deprecated * The value of the variant for the third product option. If there's no third product option, then `nil` is returned. Deprecated Deprecated. Prefer to use [`variant.options`](https://shopify.dev/docs/api/liquid/objects/variant#variant-options) instead. ```json { "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" } ```