Last active
October 11, 2017 16:16
-
-
Save boldsupport/bf3a22492d11f8f1a933ec2facad6291 to your computer and use it in GitHub Desktop.
Linked from: https://support.boldcommerce.com/hc/en-us/articles/202171933-Display-Product-Options-in-Shopify-Order-Printer-App
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- | |
Bold notes | |
Bold code 1 above the for loop - line in line_item loop, Bold code 2 below the for loop line in line_item loop | |
add {{ bold_options }} to display options, replace item.price with {{ bold_item_price }} and/or item.line_price with {{ bold_line_price }} | |
--> | |
<p style="float: right; text-align: right; margin: 0;"> | |
{{ "now" | date: "%m/%d/%y" }}<br /> | |
Invoice for {{ order_name }} | |
</p> | |
<div style="float: left; margin: 0 0 1.5em 0;" > | |
<strong style="font-size: 2em;">{{ shop_name }}</strong><br /><br /> | |
{{ shop.address }}<br/> | |
{{ shop.city }} {{ shop.province_code }} {{ shop.zip | upcase }}<br/> | |
{{ shop.country }} | |
</div> | |
<hr /> | |
<h3 style="margin: 0 0 1em 0;">Item Details</h3> | |
<table class="table-tabular" style="margin: 0 0 1.5em 0;"> | |
<thead> | |
<tr> | |
<th>Quantity</th> | |
<th>Item</th> | |
{% if show_line_item_taxes %} | |
<th>Taxes</th> | |
{% endif %} | |
<th>Price</th> | |
</tr> | |
</thead> | |
<tbody> | |
<!-- Bold 1 --> | |
{% assign hidden_variant_ids = "" %} | |
{% for line in line_items %} | |
{% for prop in line_item.properties %} | |
{% if prop.first == "_boldVariantIds" %} | |
{% assign hidden_variant_ids = hidden_variant_ids | append: prop.last | append: ',' %} | |
{% endif %} | |
{% endfor %} | |
{% endfor %} | |
<!-- Bold 1 --> | |
{% for line_item in line_items %} | |
<!-- Bold 2 --> | |
{% assign variant_id = line.variant_id | append: "" %} | |
{% if hidden_variant_ids contains variant_id %}{% continue %}{% endif %} | |
{% assign bold_item_price = line.price %} | |
{% assign bold_line_price = line.line_price %} | |
{% for prop2 in line_item.properties %} | |
{% if prop2.first == "_boldVariantIds" %} | |
{% assign bold_var_ids = prop2.last | split: "," %} | |
{% elsif prop2.first == "_boldVariantPrices" %} | |
{% assign price_index = prop2.last | split: "," %} | |
{% elsif prop2.first == "_boldVariantQtys" %} | |
{% assign bold_qtys = prop2.last | split: "," %} | |
{% endif %} | |
{% assign bold_qty = 1 %} | |
{% for price in price_index %} | |
{% if bold_qtys.length > 0 %}{% assign bold_qty = bold_qtys[forloop.index0] %}{% endif %} | |
{% assign bold_item_price = bold_item_price | plus: price %} | |
{% assign temp_price = price | times: bold_qty %} | |
{% assign bold_line_price = bold_line_price | plus: temp_price %} | |
{% endfor %} | |
{% endfor %} | |
{% assign bold_options = " " %} | |
{% for bold_option in line.properties %} | |
{% assign first_char = bold_option.first | slice: 0, 1 %} | |
{% assign opt_title = bold_option | first %} | |
{% assign opt_desc = bold_option | last %} | |
{% unless first_char == '_' or bold_option.first == 'master_builder' or bold_option.first == 'builder_id' or bold_option.first == '_boldOptionLocalStorageId' or bold_option.first == 'builder_info' or bold_option.last == "" %} | |
{% assign bold_options = bold_options | append: '<br />' | append: opt_title | append: ': ' | append: opt_desc %} | |
{% endunless%} | |
{% endfor %} | |
{% assign bold_options = bold_options | prepend: '<span class="bold_options">' | append: "</span>" %} | |
<!-- 2 --> | |
<tr> | |
<td>{{ line_item.quantity }} x</td> | |
<td><b>{{ line_item.title }}</b><br> | |
{{ bold_options }} | |
</td> | |
{% if line_item.tax_lines %} | |
<td> | |
{% for tax_line in line_item.tax_lines %} | |
{{ tax_line.price | money }} {{ tax_line.title }}<br/> | |
{% endfor %} | |
</td> | |
{% endif %} | |
<td>{{ bold_line_price | money }}</td> | |
</tr> | |
{% endfor %} | |
</tbody> | |
</table> | |
{% if transactions.size > 1 %} | |
<h3 style="margin: 0 0 1em 0;">Transaction Details</h3> | |
<table class="table-tabular" style="margin: 0 0 1.5em 0;"> | |
<thead> | |
<tr> | |
<th>Type</th> | |
<th>Amount</th> | |
<th>Kind</th> | |
<th>Status</th> | |
</tr> | |
</thead> | |
<tbody> | |
{% for transaction in transactions %} | |
<tr> | |
<td>{{ transaction.gateway | payment_method }}</td> | |
<td>{{ transaction.amount | money }}</td> | |
<td>{{ transaction.kind }}</td> | |
<td>{{ transaction.status }}</td> | |
</tr> | |
{% endfor %} | |
</tbody> | |
</table> | |
{% endif %} | |
<h3 style="margin: 0 0 1em 0;">Payment Details</h3> | |
<table class="table-tabular" style="margin: 0 0 1.5em 0;"> | |
<tr> | |
<td>Subtotal price:</td> | |
<td>{{ subtotal_price | money }}</td> | |
</tr> | |
{% for discount in discounts %} | |
<tr> | |
<td>Includes discount "{{ discount.code }}"</td> | |
<td>{{ discount.savings | money }}</td> | |
</tr> | |
{% endfor %} | |
<tr> | |
<td>Total tax:</td> | |
<td>{{ tax_price | money }}</td> | |
</tr> | |
{% if shipping_address %} | |
<tr> | |
<td>Shipping:</td> | |
<td>{{ shipping_price | money }}</td> | |
</tr> | |
{% endif %} | |
<tr> | |
<td><strong>Total price:</strong></td> | |
<td><strong>{{ total_price | money }}</strong></td> | |
</tr> | |
{% if total_paid != total_price %} | |
<tr> | |
<td><strong>Total paid:</strong></td> | |
<td><strong>{{ total_paid | money }}</strong></td> | |
</tr> | |
<tr> | |
<td><strong>Outstanding Amount:</strong></td> | |
<td><strong>{{ total_price | minus: total_paid | money }}</strong></td> | |
</tr> | |
{% endif %} | |
</table> | |
{% if note %} | |
<h3 style="margin: 0 0 1em 0;">Note</h3> | |
<p>{{ note }}</p> | |
{% endif %} | |
{% if shipping_address %} | |
<h3 style="margin: 0 0 1em 0;">Shipping Details</h3> | |
<div style="margin: 0 0 1em 0; padding: 1em; border: 1px solid black;"> | |
<strong>{{ shipping_address.name }}</strong><br/> | |
{% if shipping_address.company %} | |
{{ shipping_address.company }}<br/> | |
{% endif %} | |
{{ shipping_address.street }}<br/> | |
{{ shipping_address.city }} | |
{{ shipping_address.province_code }} | |
{{ shipping_address.zip | upcase }}<br/> | |
{{ shipping_address.country }} | |
</div> | |
{% endif %} | |
<p>If you have any questions, please send an email to <u>{{ shop.email }}</u></p> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment