Liquid Template Variables - line item

From Spiffy Stores Knowledge Base

Revision as of 15:31, 12 September 2008 by Admin (talk | contribs)

A line item represents a single line in the shopping cart.

There is one line item for each distinct product variant being purchased, regardless of the quantity of that variant in the cart. It is important to include the line item's quantity whenever displaying the item to the user. Line items can be accessed from any theme or email template which makes a cart or order object available.

Line items used in the following theme and email templates:

  • cart.liquid
  • Order Confirmation
  • New Order Notification
  • New Order Notification (mobile)
  • Shipping confirmation
  • Shipping update
  • Additional Content & Scripts

line_item.id

Returns the unique internal id of the line item.

This is normally only for internal usage.

line_item.variant

Returns the product variant for this line item.

line_item.product

Returns the product for this line_item.

For example, this code retrieves a line item's image:

{{ item.product.featured_image |  product_img_url | img_tag }}

line_item.title

Returns the title of this line item.

This is equal to the original product's title, for example, "Balloon Shirt". If the product has more than one variant, then the name of the variant will be appended to the title. So if the "Balloon Shirt" has two variants, Medium and Large, then line_item.title will be "Balloon Shirt - Medium" or "Balloon Shirt - Large". If a "Yellow Flower Baseball Cap" product only has one variant called "Default" then its line_item.title would just be "Yellow Flower Baseball Cap".

line_item.price

line_item.quantity

line_item.line_price

line_item.tax

line_item.sku

line_item.note