Skip to content

Instantly share code, notes, and snippets.

@elja
Created August 24, 2015 08:24
Show Gist options
  • Save elja/e2d81b9d5432f45e06c3 to your computer and use it in GitHub Desktop.
Save elja/e2d81b9d5432f45e06c3 to your computer and use it in GitHub Desktop.
<table class="product-summary">
<thead>
<tr><th colspan="4">Summary</th></tr>
</thead>
<tbody>
{% assign total_price = 0 %}
{% for line_item in line_items %}
{% if product.has_multiple_quantity_option? %}
<tr>
{% for choice in line_item.choices %}
{% if choice.product_option_id == product.multiple_quantity_option.id %}
<th class="name" colspan="2">{{ choice.product_sub_option.name }}</th>
{% endif %}
{% endfor %}
<td class="quantity">{{ line_item.quantity }}</td>
<td class="price">{{ line_item.total_price_with_quantity_discount | points_or_currency }}</td>
</tr>
{% endif %}
{% assign total_price = total_price | plus: line_item.total_price_with_quantity_discount %}
{% if line_item_with_quantity == null and line_item.quantity > 0 %}
{% assign line_item_with_quantity = line_item %}
{% endif %}
{% endfor %}
<tfoot>
{% if product.setup_charge %}
<tr class="setup-charge">
<th style="padding-top: 10px;" colspan="3">setup charge:</th>
<td style="padding-top: 10px;">
{{ product.setup_charge | points_or_currency }}
</td>
</tr>
{% endif %}
<tr class="discounted-price-per-item">
<th style="padding-top: 10px;" colspan="3">item price:</th>
<td style="padding-top: 10px;">
{{ line_item_with_quantity.total_price_with_quantity_discount | minus: line_item_with_quantity.options_price | points_or_currency }}
</td>
</tr>
<tr class="total">
<th style="padding-top: 10px;" colspan="3">total:</th>
<td style="padding-top: 10px;">{{ total_price | points_or_currency }}</td>
</tr>
</tfoot>
</table>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment