variant

The variant object has the following attributes:

variant.available

Returns true if the variant is available for purchase, or false if it not. For a variant to be available, its variant.inventory_quantity must be greater than zero or variant.inventory_policy must be set to continue. A variant with no variant.inventory_management is also considered available.

variant.barcode

Returns the variant's barcode.

variant.compare_at_price

Returns the variant's compare at price. Use a money filter to return the value in a monetary format.

variant.id

Returns the variant's unique ID.

variant.image

Returns the image object associated with the variant.

Input

{{ variant.image.src }}

Output

products/red-shirt.jpeg

variant.incoming

Returns true if the variant has incoming inventory.

variant.inventory_management

Returns the variant's inventory tracking service.

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.

variant.inventory_quantity

Returns the variant's inventory quantity.

variant.next_incoming_date

Returns the date when the next incoming inventory will arrive.

variant.option1

Returns the value of the variant's first option.

variant.option2

Returns the value of the variant's second option.

variant.option3

Returns the value of the variant's third option.

variant.price

Returns the variant's price. Use a money filter to return the value in a monetary format.

variant.requires_shipping

Returns true if the variant is set to require shipping, or false if it does not.

variant.selected

Returns true if the variant is currently selected by the ?variant= URL parameter, or false if it is not.

variant.sku

Returns the variant's SKU.

variant.taxable

Returns true if taxes are charged for the variant, or false if they are not.

variant.title

Returns the concatenation of all the variant's option values, joined by / characters.

Input

<!-- If variant's option1, option2, and option3 are "Red", "Small", "Wool", respectively -->
{{ variant.title }}

Output

Red / Small / Wool

variant.url

Returns a URL that is unique to only one product variant. The variant ID is used as the unique identifier.

Input

{{ variant.url }}

Output

http://my-store.myshopify.com/products/t-shirt?variant=12345678

variant.weight

Returns the variant's weight in grams. Use the weight_with_unit filter to convert it to your store's weight format or the weight unit configured on the variant.

variant.weight_unit

Returns the unit for the weight configured on the variant. Works well paired with the weight_in_unit attribute and the weight_with_unit filter.

variant.weight_in_unit

Returns the weight of the product converted to the unit configured on the variant. Works well paired with the weight_unit attribute and the weight_with_unit filter.

Want to discuss this page?

Visit the Shopify Community