The line_item object

A line_item represents a single line in the shopping cart. There is one line item for each distinct product variant in the cart. The line_item object can be accessed in all Liquid templates via cart.items, in notification email templates via line_items, on the order status page of the checkout, as well as in apps such as Order Printer.

The line_item object has the following attributes:


Returns a list of all discount allocations containing the discounted amount and the reference to the parent discount application. line_item.discount_allocations is available on line items in carts, checkouts, orders, and draft orders.


Returns the combined price of all the items in the line item. This is equal to line_item.final_price times line_item.quantity.


Returns the price of the line item including all line level discount amounts.


Returns the fulfillment of the line item.


Returns the fulfillment service associated with the line item's variant. Line items that have no fulfillment service will return manual.


Returns true if the line item's product is a gift card, or false if it is not.


Returns the weight of the line item. Use the weight_with_unit filter to format the weight.


Returns the line item's image.

You can apply the img_url filter directly to the line item instead of its image attribute. This will generate a working image URL for any object with an image attribute (variant, product, line item, collection), image object, or image src. This is useful for line items, since it will output the item's variant image or the product's featured image if no variant image exists.

In the example, note that the output is the same no matter if img_url is used on line_item or line_item.image.


{{ line_item.image | img_url: '100x100' | img_tag }}
{{ line_item | img_url: '100x100' | img_tag }}


<img src="//" />
<img src="//" />


Returns the line item key, a unique identifier for the line item. The line item key is constructed from the line item's variant ID plus a hash of the line item's properties, even if the item has no additional properties.


{{ line_item.key }}




Returns a list of line-specific discount allocations containing the discounted amount and the reference to the parent discount application. line_item.discount_allocations is available on line items in carts, checkouts, orders, and draft orders.


Returns the total amount of all discounts applied to the line item specifically. This doesn't include discounts that are added to the cart.


Returns the discount message if a script has applied a discount to the line item.

This attribute only has a value if you are using the Script Editor app.


Returns an array of selected values from the item's product options.

Elements in line_item.options_with_values can be displayed using a for loop. Each option is a key-value pair with as the option and option.value as the option value.


{% unless line_item.product.has_only_default_variant %}
    {% for option in line_item.options_with_values %}
      <li>{{ }}: {{ option.value }}</li>
    {% endfor %}
{% endunless %}


  <li>Size: 42mm</li>
  <li>Color: Silver</li>
  <li>Strap: Stainless Steel</li>


Returns the combined price of the quantity of items included in the line, before discounts were applied. This is equal to line_item.original_price multiplied by line_item.quantity.


Returns the original price of the line item before discounts were applied.


Returns the product of the line item.


Returns the ID of the line item's product. returns an array of custom information for an item that has been added to the cart.

You can capture line item properties on product pages to collect customization information for products, such as engraving text.

You add a line item property input on the product page by giving an input a name attribute with the following syntax:


Below is a basic example of how to use an HTML input of type "text" to capture customization information on the product page. You can also create a input by using the Shopify UI elements generator.

  <label for="engraving">Engraving</label>
  <input id="engraving" type="text" name="properties[Engraving]">

When accessed, array elements will be displayed using a for loop.


{% unless == empty %}
  {% for property in %}
  <li>{{ property.first }}: {{ property.last }}</li>
  {% endfor %}
{% endunless %}


  <li>Monogram: My dog is the cutest</li>
  <li>Gift wrap: Yes</li>


Returns the quantity of the line item.


Returns true if the variant of the line item requires shipping, or false if it does not.


Returns a selling_plan_allocation object when the line item contains a selling plan.

Availability of selling plan information

Selling plan group information is not recorded after a checkout is completed. As a result, when accessing a line item's selling_plan_allocation from order.line_items the following properties are not available:

  • selling_plan_group_id
  • selling_plan.group_id
  • selling_plan.options

Additionally, the following pricing properties are not available on a selling_plan_allocation object when accessed from order.line_items:

  • compare_at_price
  • price_adjustments
  • selling_plan.price_adjustments


Returns the SKU (stock keeping unit) of the line item's variant.


Returns the successfully fulfilled quantity of the line item.


Returns true if taxes are charged on the line item's variant, or false if they are not.


Returns the title of the line item. line_item.title combines both the line item's product.title and the line item's variant.title, separated by a hyphen.


{{ line_item.title }}


Balloon Shirt - Medium

To output just the product title or variant title, you can access the title of the respective variables.


Product title: {{ line_item.product.title }}
Variant title: {{ line_item.variant.title }}


Product title: Balloon Shirt
Variant title: Medium


Returns the unit price of the line item. The price reflects any discounts that are applied to the line item.


Returns a unit_price_measurement object for the line item.


Returns the relative URL of the line item's variant. The relative URL does not include your store's root URL (


Returns the variant of the line item.


Returns the ID of the line item's variant.


Returns the vendor of the line item's product.

Returns the line item's ID.

The line item ID differs depending on the context:

  • cart.items returns the ID of the line item's variant. This ID is not unique, and can be shared by multiple items of the same variant.

  • checkout.line_items returns a temporary unique hash generated for the checkout.

  • order.line_items returns a unique integer ID.