Skip to content

Instantly share code, notes, and snippets.

@elja
Created February 1, 2018 11:58
Show Gist options
  • Save elja/05e213d3f39b9e33a08f8cc10af30bc9 to your computer and use it in GitHub Desktop.
Save elja/05e213d3f39b9e33a08f8cc10af30bc9 to your computer and use it in GitHub Desktop.
{% if product.has_multiple_quantity_option? %}
<table class="product-summary">
<thead>
<tr><th colspan="4">Summary</th></tr>
</thead>
<tbody>
{% assign total_price = 0 %}
{% for line_item in line_items %}
<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>
{% 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.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 | plus: product.setup_charge | points_or_currency }}</td>
</tr>
</tfoot>
</table>
{% else %}
{% assign line_item = line_items.first %}
<table class="product-summary">
<tfoot>
{% if product.quantity_limits_message %}
<tr>
<th class='minimum-order-quantity-help' colspan='4'>
{{ product.quantity_limits_message }}
</th>
</tr>
{% endif %}
<tr class="discounted-price-per-item">
<th colspan="2" style="padding-top: 10px;">item price:</th>
<td style="padding-top: 10px;">
{{ line_item.price_with_quantity_discount | points_or_currency }}
</td>
</tr>
{% if product.setup_charge and product.setup_charge > 0 %}
<tr class="setup-charge">
<th colspan="2" style="padding-top: 10px;">
setup charge:
</th>
<td style="padding-top: 10px;">
{{ product.setup_charge | points_or_currency }}
</td>
</tr>
{% endif %}
<tr class="total">
<th colspan="2">total:</th>
<td style="padding-top: 10px;">{{ line_item.total_price_with_quantity_discount | plus: product.setup_charge | points_or_currency }}</td>
</tr>
</tfoot>
</table>
{% endif %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment