3.0 KiB
layout, title, nav
| layout | title | nav | ||
|---|---|---|---|---|
| default | variant |
|
variant
The variant object has the following attributes:
{% anchor_link "variant.available", "variant-available" %}
Returns true if the variant is available to be purchased, or false if it not. In order for a variant to be available, its variant.inventory_quantity must be greater than zero and its variant.inventory_policy must be continue.
{% anchor_link "variant.barcode", "variant-barcode" %}
Returns the variant's barcode.
{% anchor_link "variant.compare_at_price", "variant-compare_at_price" %}
Returns the variant's compare at price. Use one of the money filters to return the value in a monetary format.
{% anchor_link "variant.id", "variant-id" %}
Returns the variant's unique id.
{% anchor_link "variant.inventory_management", "variant-inventory_management" %}
Returns the variant's inventory tracking service.
{% anchor_link "variant.inventory_policy", "variant-inventory_policy" %}
Returns the string continue if the "Allow users to purchase this item, even if it is no longer in stock." checkbox is checked in the variant options in the Admin. Returns deny if it is unchecked.
{% anchor_link "variant.inventory_quantity", "variant-inventory_quantity" %}
Returns the variant's inventory quantity.
{% anchor_link "variant.option1", "variant-option1" %}
Returns the value of the variant's first option.
{% anchor_link "variant.option2", "variant-option2" %}
Returns the value of the variant's second option.
{% anchor_link "variant.option3", "variant-option3" %}
Returns the value of the variant's third option.
{% anchor_link "variant.price", "variant-price" %}
Returns the variant's price. Use one of the money filters to return the value in a monetary format.
{% anchor_link "variant.sku", "variant-sku" %}
Returns the variant's SKU.
{% anchor_link "variant.title", "variant-title" %}
Returns the concatenation of all the variant's option values, joined by a /.
Input
Output
{% anchor_link "variant.weight", "variant-weight" %}
Returns the variant's weight. Use the weight_with_unit filter to convert it to the shop's weight format.