The variant object

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.

Returns the first media item attached to the variant.

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.options

Returns an array of the variant's product option values.

Input

{% for option in variant.options %}
  - {{ option }}
{% endfor %}

Output

  - Red
  - Small
  - Wool

variant.option1

Returns the value of the variant's first product option.

variant.option2

Returns the value of the variant's second product option.

variant.option3

Returns the value of the variant's third product 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.

variant.requires_selling_plan

Returns true if the variant is set to require a selling_plan when added to the cart.

variant.selected

Returns true if the variant is currently selected. The selected variant is based on the URL parameter variant.

variant.selected_selling_plan_allocation

Returns a selling_plan_allocation object based on the URL parameter selling_plan.

For example, given the URL parameters ?variant=12345&selling_plan=8765, the selling plan allocation for the variant 12345 with a selling plan id of 8765 is returned.

If there is no selected selling plan allocation, then this property returns nil.

variant.selling_plan_allocations

An array of selling_plan_allocation objects available for the variant.

variant.sku

Returns the variant's SKU.

variant.store_availabilities

Returns a list of StoreAvailability objects.

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 product 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.unit_price

Returns the unit price of the product variant. The price reflects any discounts that are applied to the line item.

variant.unit_price_measurement

Returns a unit_price_measurement object for the product variant.

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

/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.