1

Is it possible to link to the product from the shopping cart? Something like {{ item.url }} within cart.lineItems

When using {{ product.url }} looping through craft.commerce.products I am getting a list with all product entries.

1

From the docs

{% for item in order.lineItems %}
    {% set variant = item.purchasable %}
    {% set product = variant.product %}
    <li>{{ product.getUrl() }} - {{ variant.sku }} ({{ item.qty }})</li>
{% endfor %}
2
{{ item.purchasable.url }}

should do it.

2
  • If you are using products and variants only. Mar 14 '18 at 9:41
  • Thanks a loot Luke. It works really well, with a little correction: {{ item.purchasable.url }}
    – Nermin
    Mar 14 '18 at 10:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.