I have two product types, 1) Materials and 2) Services.
Is there a way on the order summary page to list out the "materials" line items first, followed by the "services" line items below? I can't seem to figure out how to access the product type from cart.lineItems
.
Here is what I'm currently using but it seems a little clunky:
<h2>Products</h2>
{% for item in cart.lineItems %}
{% set variant = item.purchasable %}
{% set product = variant.product %}
{% if product.type == 'materials' %}
<li>{{ product.title }} - {{ variant.sku }} ({{ item.qty }})</li>
{% endif %}
{% endfor %}
<h2>Services</h2>
{% for item in cart.lineItems %}
{% set variant = item.purchasable %}
{% set product = variant.product %}
{% if product.type == 'services' %}
<li>{{ product.title }} - {{ variant.sku }} ({{ item.qty }})</li>
{% endif %}
{% endfor %}