Product
Product object represents a product sold in web-store. Can be either product or product variant.
List of available attributes
- alt_image?
- alt_image
- assets
- available?
- categories
- currency
- dimensions
- id
- image?
- image
- name
- og_description
- og_image?
- og_image
- out_of_stock?
- photos
- price
- price_min
- price_max
- price_with_tax
- price_min_with_tax
- price_max_with_tax
- sale_price
- sale_price_with_tax
- effective_price
- effective_price_with_tax
- effective_price_min
- effective_price_max
- effective_price_min_with_tax
- effective_price_max_with_tax
- on_sale?
- sale_percentage
- reserved_quantity
- sku
- slug
- status
- stock
- tax_rate
- uses_variants
- variants_count
- weight
alt_image?
Returns true
if the product has an alternative image (i.e. the product has a list of
assets with at least one member).
alt_image
Returns the product's alternative image (the second member of the product's assets list).
assets
Returns an array of the product's assets as Assets.
available?
Returns true
if product is available, i.e product status is live, store is active and set up correctly. Returns true
even if product is out of stock.
categories
Returns an array with the products categories. Each item is of category type.
currency
Returns product currency.
dimensions
Returns an object with the product dimensions. The object has the following attributes:
height
- product height. Usage example:{{ product.dimensions.height }}
.length
- product length. Usage example:{{ product.dimensions.length }}
.width
- product width. Usage example:{{ product.dimensions.width }}
.unit
- unit of measurement. Usage example:{{ product.dimensions.unit }}
. Default value ism
.display_unit
- preferred unit for display. Usage example:{{ product.dimensions.display_unit }}
. Default value iscm
.
id
Returns product ID.
image?
Returns true
when the product has an image. Returns false
otherwise.
image
Returns the product's main image. Image is first element of the assets.
name
Returns translated product name based on locale.
og_description
Returns translated OG description, based on the current locale.
og_image?
Returns true
when the product has an image. Returns false
otherwise.
og_image
Returns Image object of the product image. Image URLs refers to the current site domain.
out_of_stock?
Returns true
if the product is out of stock. Returns false
otherwise.
photos
Returns an array of the product's assets where content type is image. Each item is of Asset type.
price
Returns product price before tax.
price_min
Returns the lowest price of product variants before tax. If product has no variants, returns the product price.
price_max
Returns the highest price of product variants before tax. If product has no variants, returns the product price.
price_with_tax
Returns product price after tax.
price_min_with_tax
Returns lowest product variant price after tax. If product has no variants, returns the product price.
price_max_with_tax
Returns highest product variant price after tax. If product has no variants, returns the product price.
sale_price
Returns product sale price before tax.
sale_price_with_tax
Returns product sale price after tax.
effective_price
Returns product's effective price before tax, which is the lowest of price
and sale_price
.
effective_price_with_tax
Returns product's effective price after tax.
effective_price_min
Returns the lowest effective price of product variants before tax. If product has no variants, returns the product's effective price.
effective_price_max
Returns the highest effective price of product variants before tax. If product has no variants, returns the product's effective price.
effective_price_min_with_tax
Returns the lowest effective price of product variants after tax. If product has no variants, returns the product's effective price after tax.
effective_price_max_with_tax
Returns the highest effective price of product variants after tax. If product has no variants, returns the product's effective price after tax.
on_sale?
Returns true
if product has sale price applied. Returns false
otherwise.
sale_percentage
Returns product's sale percentage. If product is not on sale, then returns 0. If product's min and max effective prices differ, returns nil
reserved_quantity
Returns the number of reserved products.
sku
Returns the product SKU.
slug
Returns the product slug.
status
Returns the product status, "draft"
if the product is not live and "live"
when product is live.
stock
Returns the number of products in stock.
tax_rate
Returns the product's tax rate.
uses_variants
Returns true
if the product uses variants. Otherwise returns false
.
variants_count
Returns the number of variants the product has.
weight
Returns an object with the product weight. The object has the following attributes:
weight
- product weight. Usage example:{{ product.weight.weight }}
.unit
- unit of weight. Usage example:{{ product.weight.unit }}
. Default value iskg
.unit
- preferred unit for display. Usage example:{{ product.weight.display_unit }}
. Default value iskg
.