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's 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.

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

Returns whether the variant has been matched by a storefront filter. Returns true if it's been matched, and false if not.

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.