Skip to Content

Product Variant

The product_variant object represents a specific variant of a product, including its price, availability, options, and inventory information.

Usage Example

{%- comment -%} Show variant details {%- endcomment -%} <div> <strong>Variant:</strong> {{ product_variant.title }}<br> Price: {{ product_variant.price | money_with_currency }}<br> {% if product_variant.sku %}<br>SKU: {{ product_variant.sku }}{% endif %} </div> {%- comment -%} Show options for this variant {%- endcomment -%} <ul> {% for option in product_variant.options %} <li>{{ option.option }}: {{ option.value }}</li> {% endfor %} </ul>

Properties

product

Returns the product object.

product_id

Returns the variant product id.

measure_unit

Returns the measure unit name

weight_unit

Returns the weight unit name

unit

Returns the product quantity unit

selected

Returns true if this variant is selected in the product page.

image

Returns the image of the product variant. Alias for featured_image.

Returns the featured image of the product variant.

previous_prices

Returns information about the previous prices if such records are found.

previous_lower_price

Returns information about the previous lower price if such is recorded in the last 30 days.

is_new

Returns true if products in considered as new.

option1

Returns the first option.

option2

Returns the second option.

option3

Returns the third option.

options

Returns all options.

url

Returns the url.

id

Returns the id.

title

Returns the title.

has_customizations_with_price

Returns true if some of the customizations are increasing product price.

customizations

Returns product customizations.

in_preview

Returns true if product is in preview.

is_available

Returns true if product is available for purchase.

is_directly_buyable

Returns true if product can be bought without selecting any attributes.

gtin

Returns the GTIN number.

model_number

Returns the product model number.

rate

Returns the tax rate. This is same as product tax rate.

bundle_contents

Returns the bundle contents. Each rows has the values of:

  • product
  • options:
    • image
    • name
    • value
  • quantity: quantity included

discount_information

Returns the discount if any.

promotion

Returns the promotion if any.

bulk_rates

Returns the bulk rates if any.

original_net_price

Returns the original net price without any discounts

original_price

Returns the original price without any discounts

net_price

Returns the net price

price

Returns the price

tax

Returns the tax amount

is_out_of_stock

Returns true if product is out of stock

stock_alarm

Returns true if product is low on stock.

discontinued_product

Returns true if product won’t be restocked when it runs out of stock.

inventory_management

Returns the inventory management.

notifications_supported?

Returns true if product supports availability notifications.

subscribed_to_notifications?

Returns true if customer has subscribed to availability notifications.

inventory_policy

Returns the inventory policy, continue or deny.

attribute_based_inventory?

Returns true if inventory is based on attributes rather than on product itself.

stock

Returns the stock quantity

stock_in_other_inventories

Returns true if product has stock set in other inventories.

quantities_in_other_inventories

Returns the stock quantity in other inventories. Returns an object with the following properties:

  • inventory: inventory
  • quantity: stock quantity
  • location: location of the inventory
  • alarm_level: alarm level
  • sku: stock keeping unit
  • is_low_on_stock: true if product is low on stock This is only returns the inventories where the product has specifically set stock. If you need all inventories, use store.inventories.

sku

Returns the SKU

deliverytime

Returns the delivery object

weight

Returns the weight

length

Returns the length

height

Returns the height

width

Returns the width

in_customers_wishlist?

Returns true if products is in customers wishlist.

customer_has_purchased

Returns true if customer has purchased the product.

additional_buy_buttons

Returns true if there are additional buy buttons.

content_for_additional_buy_buttons

Returns the content for the additional buy buttons.

financing_offers

Returns the financing offers.

content_for_financing_offers

Returns the content for the financing offers.

created_at

Returns the creation date.

updated_at

Returns the last updated date.

requires_shipping?

Returns true if product requires shipping.

min_quantity

Returns the minimum quantity that can be bought.

max_quantity

Returns the maximum quantity that can be bought.