Objetos /
line_item
Una línea del carrito.
Dónde está
cart.items.
Propiedades
| Propiedad | Tipo | Qué es |
|---|---|---|
line_item.key | texto | Clave de la línea (para /cart/change.js). |
line_item.variant_id | texto | Variante. |
line_item.product_id | texto | Producto. |
line_item.title | texto | Producto y variante. |
line_item.product_title | texto | Nombre del producto. |
line_item.variant_title | texto o nil | Opciones de la variante. |
line_item.options | array de textos | Valores de las opciones. |
line_item.quantity | número | Cantidad. |
line_item.price | número (unidades menores) | Precio unitario. |
line_item.final_price | número (unidades menores) | Precio unitario final. |
line_item.line_price | número (unidades menores) | Precio por la cantidad. |
line_item.final_line_price | número (unidades menores) | Total final de la línea. |
line_item.sku | texto | SKU. |
line_item.url | texto | Link al producto con la variante. |
line_item.image | image o nil | Imagen. |
line_item.requires_shipping | booleano | Si necesita envío. |
line_item.max_quantity | número o nil | Máximo que se puede pedir (según el stock), si hay tope. |
line_item.product | objeto | id, title, handle, url. |
line_item.variant | objeto | id, title, price, sku. |
Ejemplo
{% for item in cart.items %}
<tr>
<td>{{ item.image | image_url: width: 120 | image_tag: alt: item.product_title }}</td>
<td><a href="{{ item.url }}">{{ item.product_title }}</a> {{ item.variant_title }}</td>
<td>{{ item.quantity }}</td>
<td>{{ item.final_line_price | money }}</td>
</tr>
{% endfor %}