Liquid Template Variables - variant

From Spiffy Stores Knowledge Base

The Liquid template variable variant has the following attributes:

Returns the unique internal number of the variant.

This is normally only for internal usage.


Returns the title of this variant. A variant title is usually a short value that distinguishes it from the other variants of the product. For example, it could be something like "S", "M" or "L" for clothes sizes or "red" or "green" for product colours.


Returns the variant's price.


Returns the recommend retail price for this product variant. This may also be the price of the variant before being discounted or put on sale.

Returns the amount of a variant's discount. If the variant cannot be discounted, then 0 will be returned. A variant can only be discounted if it is determined to be eligible by a Shopping Cart Discount rule.


Returns true if the variant is available and not sold out.

This value can be used to either hide variants that are not available for sale, or to mark them as "Sold Out".

Variants which are not available should not be placed in the shopping cart.

For example:

{% if variant.available == true %}
   We currently have {{ variant.inventory_quantity }} in stock.
{% else %}
   Sold out!
{% endif %}


Return true if this variant has inventory management enabled.


Returns the number of this variant that are in stock. Note that this value will only be valid if variant.inventory is true.


Return the variant's inventory management service. Typically this will be 'spiffy', if the inventory is being managed by your store.


Return the variant's inventory policy that will be applied when an item is sold out. The available values are 'deny', 'continue' or 'archive'.

If the policy is 'deny', then no further orders will be allowed until the item is back in stock.

If the policy is 'continue', then further orders will be permitted and the item will be back-ordered.

If the policy is 'archive', then no further orders will be allowed and the product will be hidden and will no longer be displayed in the store.


Returns the value of option 1 for the given variant.


Returns the value of option 2 for the given variant.


Returns the value of option 3 for the given variant.


Returns the weight of the variant. This will always be in grams. To display the value according to your store's weight system, use the weight_with_unit filter.

This product weights {{ product.variants.first.weight | weight_with_unit }}


Returns the variant's SKU.


Return the variant's barcode.


Return the metafields for the variant.

Metafields can only be managed using the Spiffy Stores API.


Return true if this variant needs to be shipped. Typically physical goods will need shipping, whereas services or digital items will not need shipping.


Return true is this variant is taxable. Various tax jurisdictions often specify specific items that are exempt from taxation. This setting can be used highlight which items do not attract tax.


Return true if this variant is eligible for free shipping.


Return true if this variant must be shipped separately because it requires special handling or is large and bulky and cannot be shipping together with other items.


Return the image associated with the variant, if it has been defined.

{{ variant.featured_image.src }} ==> 'products/1504_cute_dog.jpg'


This is an alias for the variant.featured_image function.