Hi, my draft order emails and order confirmation emails don’t include the product URL so the customer can navigate back to the website and look at the products in greater detail. Is this something that can be added easily? Chat GPT spat out some code for me but it’s not clear where it should go. Thanks!
Add a link to the line product image by using the a tag, then they can click the image navigate back to the product detail page.
{{ shop.url }}{{ line.url }} is the full link of the line item’s variant.
This is a complete order confirmation email template modified from the official default template.You can modify your email template according to this.
If you have not modified the default template, you can paste it directly. Remember to back up your original template first.Feel free to let me know if you want me to help you out.
Order confirmation email template(added product link to the line item)
{% capture email_title %}
{% if has_pending_payment %}
Thank you for your order!
{% else %}
Thank you for your purchase!
{% endif %}
{% endcapture %}
{% capture email_body %}
{% if has_pending_payment %}
{% if buyer_action_required %}
You’ll get a confirmation email after completing your payment.
{% else %}
Your payment is being processed. You'll get an email when your order is confirmed.
{% endif %}
{% else %}
{% if requires_shipping %}
{% case delivery_method %}
{% when 'pick-up' %}
You’ll receive an email when your order is ready for pickup.
{% when 'local' %}
Hi {{ customer.first_name }}, we're getting your order ready for delivery.
{% else %}
We're getting your order ready to be shipped. We will notify you when it has been sent.
{% endcase %}
{% if delivery_instructions != blank %}
**Delivery information:** {{ delivery_instructions }}
{% endif %}
{% if consolidated_estimated_delivery_time %}
{% if has_multiple_delivery_methods %}
### Estimated delivery
{{ consolidated_estimated_delivery_time }}
{% else %}
Estimated delivery **{{ consolidated_estimated_delivery_time }}**
{% endif %}
{% endif %}
{% endif %}
{% endif %}
{% assign gift_card_line_items = line_items | where: "gift_card" %}
{% assign found_gift_card_with_recipient_email = false %}
{% for line_item in gift_card_line_items %}
{% if line_item.properties["__shopify_send_gift_card_to_recipient"] and line_item.properties["Recipient email"] %}
{% assign found_gift_card_with_recipient_email = true %}
{% break %}
{% endif %}
{% endfor %}
{% if found_gift_card_with_recipient_email %}
Your gift card recipient will receive an email with their gift card code.
{% elsif gift_card_line_items.first %}
You’ll receive separate emails for any gift cards.
{% endif %}
{% endcapture %}
<table>
<table>
<table>
<table>
<td>
{%- if shop.email_logo_url %}
{%- else %}
#
{{ shop.name }}
{%- endif %}
</td>
{%- if po_number %}
{%- endif %}
<table>
<tr>
<td>
Order {{ order_name }}
</td>
</tr>
<tr>
<td>
PO number #{{ po_number }}
</td>
</tr>
</table>
</table>
</table>
</table>
<table>
<table>
## {{ email_title }}
{{ email_body }}
{% assign transaction_count = transactions | size %}
{% if transaction_count > 0 %}
{% for transaction in transactions %}
{% if transaction.show_buyer_pending_payment_instructions? %}
{{transaction.buyer_pending_payment_notice}}
{% for instruction in transaction.buyer_pending_payment_instructions %}
{% endfor %}
{% for instruction in transaction.buyer_pending_payment_instructions %}
{% endfor %}
<table>
<tr>
<td>
{{ instruction.header }}
</td>
<td>
Amount
</td>
</tr>
<tr>
<td>
{{ instruction.value }}
</td>
<td>
{{transaction.amount | money}}
</td>
</tr>
</table>
{% endif %}
{% endfor%}
{% endif %}
{% if order_status_url %}
<table>
<tr>
<td>
</td>
</tr>
<table>
<tr>
<td>
View your order
</td>
</tr>
</table>
{% if shop.url %}
<table>
<tr>
<td>
or Visit our store
</td>
</tr>
</table>
{% endif %}
</table>
{% else %}
{% if shop.url %}
<table>
<table>
<tr>
<td>
Visit our store
</td>
</tr>
</table>
</table>
{% endif %}
{% endif %}
</table>
</table>
<table>
<table>
<tr>
<td>
### Order summary
</td>
</tr>
</table>
<table>
{% for line in subtotal_line_items %}
{% endfor %}
<table>
{% assign expand_bundles = false %}
{% if expand_bundles and line.bundle_parent? %}
{% else %}
{% endif %}
{% if expand_bundles and line.bundle_parent? %}
<table>
<td>
{% if line.image %}
{% else %}
{% endif %}
</td>
<td>
{% if line.image %}
{% else %}
{% endif %}
</td>
{% if line.product.title %}
{% assign line_title = line.product.title %}
{% else %}
{% assign line_title = line.title %}
{% endif %}
{% if line.quantity < line.quantity %}
{% capture line_display %}
{{ line.quantity }} of {{ line.quantity }}
{% endcapture %}
{% else %}
{% assign line_display = line.quantity %}
{% endif %}
{{ line_title }} × {{ line_display }}
{% if line.variant.title != 'Default Title' and line.bundle_parent? == false %}
{{ line.variant.title }}
{% elsif line.variant.title != 'Default Title' and line.bundle_parent? and expand_bundles == false %}
{{ line.variant.title }}
{% endif %}
{% if expand_bundles %}
{% for component in line.bundle_components %}
<table>
<table>
<tr>
<td>
{% if component.image %}
{% elsif component.image_url %}
{% else %}
{% endif %}
</td>
<td>
{% if component.product.title %}
{% assign component_title = component.product.title %}
{% else %}
{% assign component_title = component.title %}
{% endif %}
{% assign component_display = component.quantity %}
{{ component_title }} × {{ component_display }}
{% if component.variant.title != 'Default Title'%}
{{ component.variant.title }}
{% endif %}
</td>
</tr>
</table>
</table>
{% endfor %}
{% else %}
{% for group in line.groups %}
Part of: {{ group.display_title }}
{% endfor %}
{% endif %}
{% if line.gift_card and line.properties["__shopify_send_gift_card_to_recipient"] %}
{% for property in line.properties %}
{% assign property_first_char = property.first | slice: 0 %}
{% if property.last != blank and property_first_char != '_' %}
<dt>{{ property.first }}:</dt>
<dd>
{% if property.last contains '/uploads/' %}
{{ property.last | split: '/' | last }}
{% else %}
{{ property.last }}
{% endif %}
</dd>
{% endif %}
{% endfor %}
{% endif %}
{% if line.selling_plan_allocation %}
{{ line.selling_plan_allocation.selling_plan.name }}
{% endif %}
{% if line.refunded_quantity > 0 %}
Refunded
{% endif %}
{% if line.discount_allocations %}
{% for discount_allocation in line.discount_allocations %}
{% if discount_allocation.discount_application.target_selection != 'all' %}
{{ discount_allocation.discount_application.title | upcase }}
(-{{ discount_allocation.amount | money }})
{% endif %}
{% endfor %}
{% endif %}
{% else %}
{% endif %}
{% if line.original_line_price != line.final_line_price %}
<del>{{ line.original_line_price | money }}</del>
{% endif %}
{% if line.final_line_price > 0 %}
{{ line.final_line_price | money }}
{% else %}
Free
{% endif %}
</table>
</table>
<table>
<td>
</td>
{% assign total_order_discount_amount = 0 %}
{% assign has_shipping_discount = false %}
{% assign epsilon = 0.00001 %}
{% for discount_application in discount_applications %}
{% if discount_application.target_selection == 'all' and discount_application.target_type == 'line_item' %}
{% assign order_discount_count = order_discount_count | plus: 1 %}
{% assign total_order_discount_amount = total_order_discount_amount | plus: discount_application.total_allocated_amount %}
{% endif %}
{% if discount_application.target_type == 'shipping_line' %}
{% assign has_shipping_discount = true %}
{% assign shipping_discount_title = discount_application.title %}
{% if discount_application.total_allocated_amount == 0 %}
{% assign discount_value_price = discount_application.value | times: 100 %}
{% else %}
{% assign discount_value_price = discount_application.total_allocated_amount %}
{% endif %}
{% assign shipping_amount_minus_discount_value_price = shipping_price | minus: discount_value_price %}
{% assign shipping_amount_minus_discount_value_price_abs = shipping_amount_minus_discount_value_price | abs %}
{% assign discount_application_value_type = discount_application.value_type | strip %}
{% if shipping_amount_minus_discount_value_price_abs < epsilon or discount_application_value_type == 'percentage' and discount_application.value == 100 %}
{% assign free_shipping = true %}
{% else %}
{% assign discounted_shipping_price = shipping_amount_minus_discount_value_price %}
{% endif %}
{% endif %}
{% endfor %}
{% if order_discount_count > 0 %}
{% if order_discount_count == 1 %}
{% endif %}
{% if order_discount_count > 1 %}
{% endif %}
{% for discount_application in discount_applications %}
{% if discount_application.target_selection == 'all' and discount_application.target_type != 'shipping_line' %}
{% endif %}
{% endfor %}
{% endif %}
{% unless retail_delivery_only %}
{% if delivery_method == 'pick-up' %}
{% else %}
{% if has_shipping_discount %}
{% if free_shipping == true %}
{% else %}
{% endif %}
{% else %}
{% endif %}
{% endif %}
{% endunless %}
{% if total_duties %}
{% endif %}
{% if total_tip and total_tip > 0 %}
{% endif %}
<table>
<tr>
<td>
Subtotal
</td>
<td>
**{{ subtotal_price | plus: total_order_discount_amount | money }}**
</td>
</tr>
<tr>
<td>
Order discount
</td>
<td>
**-{{ total_order_discount_amount | money }}**
</td>
</tr>
<tr>
<td>
Order discounts
</td>
<td>
**-{{ total_order_discount_amount | money }}**
</td>
</tr>
<tr>
<td>
{{ discount_application.title }} (-{{ discount_application.total_allocated_amount | money }})
</td>
</tr>
<tr>
<td>
Pickup
</td>
<td>
**{{ shipping_price | money }}**
</td>
</tr>
<td>
Shipping
</td>
<del>{{ shipping_price | money}} </del>
**Free**
Shipping
<del>{{ shipping_price | money }} </del>
**{{ discounted_shipping_price | money }}**
{{ shipping_discount_title }} (-{{ discount_value_price | money }})
Shipping
**{{ shipping_price | money }}**
Duties
**{{ total_duties | money }}**
Taxes
**{{ tax_price | money }}**
Tip
**{{ total_tip | money }}**
</table>
{% assign transaction_size = 0 %}
{% assign transaction_amount = 0 %}
{% assign net_transaction_amount_rounding = 0 %}
{% for transaction in transactions %}
{% if transaction.status == "success" %}
{% if transaction.kind == "sale" or transaction.kind == "capture" %}
{% assign transaction_size = transaction_size | plus: 1 %}
{% assign transaction_amount = transaction_amount | plus: transaction.amount %}
{% if transaction.amount_rounding != nil %}
{% assign net_transaction_amount_rounding = net_transaction_amount_rounding | plus: transaction.amount_rounding %}
{% endif %}
{% elsif transaction.kind == "refund" or transaction.kind == "change" %}
{% assign transaction_size = transaction_size | plus: 1 %}
{% assign transaction_amount = transaction_amount | minus: transaction.amount %}
{% if transaction.amount_rounding != nil %}
{% assign net_transaction_amount_rounding = net_transaction_amount_rounding | minus: transaction.amount_rounding %}
{% endif %}
{% endif %}
{% endif %}
{% endfor %}
{% if payment_terms and payment_terms.automatic_capture_at_fulfillment == false or b2b? %}
{% assign next_payment = payment_terms.next_payment %}
{% assign due_at_date = next_payment.due_at | date: "%b %d, %Y" %}
{% if net_transaction_amount_rounding != 0 %}
{% endif %}
{% assign next_amount_due = total_price %}
{% if next_payment %}
{% assign next_amount_due = next_payment.amount_due %}
{% endif %}
{% if payment_terms.type == 'receipt' %}
{% elsif payment_terms.type == 'fulfillment' %}
{% else %}
{% endif %}
{% else %}
{% if net_transaction_amount_rounding != 0 %}
{% if financial_status == 'paid' %}
{% endif %}
{% endif %}
{% if transaction_amount != total_price and payment_terms == nil%}
{% endif %}
{% endif %}
<table>
<tr>
<td>
Total
</td>
<td>
**{{ total_price | money_with_currency }}**
</td>
</tr>
<tr>
<td colspan="2">
</td>
</tr>
<tr>
<td>
Cash rounding
</td>
<td>
**{% if net_transaction_amount_rounding < 0 %}-{% endif %} {{ net_transaction_amount_rounding | abs | money }}**
</td>
</tr>
<tr>
<td colspan="2">
</td>
</tr>
<tr>
<td>
Total paid today
</td>
<td>
**{{ transaction_amount | plus: net_transaction_amount_rounding | money_with_currency }}**
</td>
</tr>
<tr>
<td>
Total due on receipt
</td>
<td>
**{{ next_amount_due | money_with_currency }}**
</td>
</tr>
<tr>
<td>
Total due on fulfillment
</td>
<td>
**{{ next_amount_due | money_with_currency }}**
</td>
</tr>
<tr>
<td>
Total due {{ due_at_date }}
</td>
<td>
**{{ next_amount_due | money_with_currency }}**
</td>
</tr>
<tr>
<td>
Total
</td>
<td>
**{{ total_price | money_with_currency }}**
</td>
</tr>
<tr>
<td colspan="2">
</td>
</tr>
<tr>
<td>
Cash rounding
</td>
<td>
**{% if net_transaction_amount_rounding < 0 %}-{% endif %} {{ net_transaction_amount_rounding | abs | money }}**
</td>
</tr>
Paid
<small>{{ gateway | capitalize }}</small>
**{{ transaction_amount | plus: net_transaction_amount_rounding | money_with_currency }}**
Total paid today
**{{ transaction_amount | plus: net_transaction_amount_rounding | money_with_currency }}**
</table>
{% if total_discounts > 0 %}
You saved {{ total_discounts | money }}
{% endif %}
{% unless payment_terms %}
{% if transaction_size > 1 or transaction_amount < total_price %}
{% for transaction in transactions %}
{% assign amount_rounding = 0 %}
{% if transaction.amount_rounding != 0 %}
{% assign amount_rounding = transaction.amount_rounding %}
{% endif %}
{% if transaction.status == "success" and transaction.kind == "capture" or transaction.kind == "sale" %}
{% if transaction.payment_details.gift_card_last_four_digits %}
{% capture transaction_name %}Gift card (ending with {{ transaction.payment_details.gift_card_last_four_digits }}){% endcapture %}
{% elsif transaction.payment_details.credit_card_company %}
{% capture transaction_name %}{{ transaction.payment_details.credit_card_company }} (ending in {{ transaction.payment_details.credit_card_last_four_digits }}){% endcapture %}
{% else %}
{% capture transaction_name %}{{ transaction.gateway_display_name }}{% endcapture %}
{% endif %}
{% endif %}
{% if transaction.kind == 'refund' %}
{% if transaction.payment_details.gift_card_last_four_digits %}
{% assign refund_method_title = transaction.payment_details.type %}
{% elsif transaction.payment_details.credit_card_company %}
{% assign refund_method_title = transaction.payment_details.credit_card_company %}
{% else %}
{% assign refund_method_title = transaction.gateway_display_name %}
{% endif %}
{% endif %}
{% endfor %}
<table>
<tr>
<td colspan="2">
</td>
</tr>
<tr>
<td colspan="2">
</td>
</tr>
<tr>
<td>
{{transaction_name}}
</td>
<td>
**{{ transaction.amount | plus: amount_rounding | money }}**
</td>
</tr>
Refund
<small>{{ refund_method_title | replace: '_', ' ' | capitalize }}</small>
**- {{ transaction.amount | plus: amount_rounding | money }}**
</table>
{% endif %}
{% endunless %}
</table>
</table>
</table>
<table>
<table>
<tr>
<td>
### Customer information
</td>
</tr>
</table>
<table>
{% if requires_shipping and shipping_address %}
{% endif %}
{% if billing_address %}
{% endif %}
<table>
<tr>
<td>
#### Shipping address
{{ shipping_address | format_address }}
</td>
<td>
#### Billing address
{{ billing_address | format_address }}
</td>
</tr>
</table>
{% if company_location %}
{% endif %}
{% if transaction_size > 0 or payment_terms and payment_terms.automatic_capture_at_fulfillment == false or b2b? %}
{% endif %}
{% if requires_shipping and shipping_address %}
{% if shipping_method %}
{% endif %}
{% endif %}
<table>
<tr>
<td>
#### Location
{{ company_location.name }}
</td>
<td>
#### Payment
{% if payment_terms %}
{% assign due_date = payment_terms.next_payment.due_at | default: nil %}
{% if payment_terms.type == 'receipt' or payment_terms.type == 'fulfillment' and payment_terms.next_payment.due_at == nil %}
{{ payment_terms.translated_name }}
{% else %}
{{ payment_terms.translated_name }}: Due {{ due_date | date: format: 'date' }}
{% endif %}
{% endif %}
{% if transaction_size > 0 %}
{% for transaction in transactions %}
{% if transaction.status == "success" or transaction.status == "pending" %}
{% if transaction.kind == "capture" or transaction.kind == "sale" %}
{% if transaction.payment_details.gift_card_last_four_digits %}
ending with {{ transaction.payment_details.gift_card_last_four_digits }}
{% elsif transaction.payment_details.credit_card_company %}
ending with {{ transaction.payment_details.credit_card_last_four_digits }}
{% elsif transaction.gateway_display_name == "Gift card" %}
ending with {{ transaction.payment_details.gift_card.last_four_characters | upcase }}
Gift card balance - **{{ transaction.payment_details.gift_card.balance | money }}**
{% elsif transaction.gateway_display_name != "Shop Cash" %}
{{ transaction.gateway_display_name }}
{% endif %}
{% elsif transaction.kind == "authorization" and transaction.gateway_display_name == "Shop Cash" %}
Shop Cash
{% endif %}
{% endif %}
{% endfor %}
{% endif %}
</td>
</tr>
<tr>
<td>
#### Shipping method
{% if delivery_promise_branded_shipping_line %}
{{ delivery_promise_branded_shipping_line }}
{% else %}
{{ shipping_method.title }}
{% endif %}
</td>
</tr>
</table>
</table>
</table>
<table>
<table>
<tr>
<td>
If you have any questions, reply to this email or contact us at [{{ shop.email }}](mailto:{{ shop.email }})
</td>
</tr>
</table>
</table>
</table>
{%- if billing_address.country_code == 'DE' or billing_address.country_code == 'DK' -%}
{%- if shop.terms_of_service.body != blank -%}
{{ shop.terms_of_service | attach_as_pdf: "Terms of service" }}
{%- endif -%}
{%- if shop.refund_policy.body != blank -%}
{{ shop.refund_policy | attach_as_pdf: "Refund policy" }}
{%- endif -%}
{%- endif -%}
Thank you! What about the Draft order invoice?
Is there a way to hyperlink the product name as well? People might not know they can click on the image.
Below are the complete “order confirmation” and “draft order invoice” email templates with hyperlinks to the product on both the product image and name
1、order confirmation
{% capture email_title %}
{% if has_pending_payment %}
Thank you for your order!
{% else %}
Thank you for your purchase!
{% endif %}
{% endcapture %}
{% capture email_body %}
{% if has_pending_payment %}
{% if buyer_action_required %}
You’ll get a confirmation email after completing your payment.
{% else %}
Your payment is being processed. You'll get an email when your order is confirmed.
{% endif %}
{% else %}
{% if requires_shipping %}
{% case delivery_method %}
{% when 'pick-up' %}
You’ll receive an email when your order is ready for pickup.
{% when 'local' %}
Hi {{ customer.first_name }}, we're getting your order ready for delivery.
{% else %}
We're getting your order ready to be shipped. We will notify you when it has been sent.
{% endcase %}
{% if delivery_instructions != blank %}
**Delivery information:** {{ delivery_instructions }}
{% endif %}
{% if consolidated_estimated_delivery_time %}
{% if has_multiple_delivery_methods %}
### Estimated delivery
{{ consolidated_estimated_delivery_time }}
{% else %}
Estimated delivery **{{ consolidated_estimated_delivery_time }}**
{% endif %}
{% endif %}
{% endif %}
{% endif %}
{% assign gift_card_line_items = line_items | where: "gift_card" %}
{% assign found_gift_card_with_recipient_email = false %}
{% for line_item in gift_card_line_items %}
{% if line_item.properties["__shopify_send_gift_card_to_recipient"] and line_item.properties["Recipient email"] %}
{% assign found_gift_card_with_recipient_email = true %}
{% break %}
{% endif %}
{% endfor %}
{% if found_gift_card_with_recipient_email %}
Your gift card recipient will receive an email with their gift card code.
{% elsif gift_card_line_items.first %}
You’ll receive separate emails for any gift cards.
{% endif %}
{% endcapture %}
<table>
<table>
<table>
<table>
<td>
{%- if shop.email_logo_url %}
{%- else %}
#
{{ shop.name }}
{%- endif %}
</td>
{%- if po_number %}
{%- endif %}
<table>
<tr>
<td>
Order {{ order_name }}
</td>
</tr>
<tr>
<td>
PO number #{{ po_number }}
</td>
</tr>
</table>
</table>
</table>
</table>
<table>
<table>
## {{ email_title }}
{{ email_body }}
{% assign transaction_count = transactions | size %}
{% if transaction_count > 0 %}
{% for transaction in transactions %}
{% if transaction.show_buyer_pending_payment_instructions? %}
{{transaction.buyer_pending_payment_notice}}
{% for instruction in transaction.buyer_pending_payment_instructions %}
{% endfor %}
{% for instruction in transaction.buyer_pending_payment_instructions %}
{% endfor %}
<table>
<tr>
<td>
{{ instruction.header }}
</td>
<td>
Amount
</td>
</tr>
<tr>
<td>
{{ instruction.value }}
</td>
<td>
{{transaction.amount | money}}
</td>
</tr>
</table>
{% endif %}
{% endfor%}
{% endif %}
{% if order_status_url %}
<table>
<tr>
<td>
</td>
</tr>
<table>
<tr>
<td>
View your order
</td>
</tr>
</table>
{% if shop.url %}
<table>
<tr>
<td>
or Visit our store
</td>
</tr>
</table>
{% endif %}
</table>
{% else %}
{% if shop.url %}
<table>
<table>
<tr>
<td>
Visit our store
</td>
</tr>
</table>
</table>
{% endif %}
{% endif %}
</table>
</table>
<table>
<table>
<tr>
<td>
### Order summary
</td>
</tr>
</table>
<table>
{% for line in subtotal_line_items %}
{% endfor %}
<table>
{% assign expand_bundles = false %}
{% if expand_bundles and line.bundle_parent? %}
{% else %}
{% endif %}
{% if expand_bundles and line.bundle_parent? %}
<table>
<td>
{% if line.image %}
{% else %}
{% endif %}
</td>
<td>
{% if line.image %}
{% else %}
{% endif %}
</td>
{% if line.product.title %}
{% assign line_title = line.product.title %}
{% else %}
{% assign line_title = line.title %}
{% endif %}
{% if line.quantity < line.quantity %}
{% capture line_display %}
{{ line.quantity }} of {{ line.quantity }}
{% endcapture %}
{% else %}
{% assign line_display = line.quantity %}
{% endif %}
{{ line_title }} × {{ line_display }}
{% if line.variant.title != 'Default Title' and line.bundle_parent? == false %}
{{ line.variant.title }}
{% elsif line.variant.title != 'Default Title' and line.bundle_parent? and expand_bundles == false %}
{{ line.variant.title }}
{% endif %}
{% if expand_bundles %}
{% for component in line.bundle_components %}
<table>
<table>
<tr>
<td>
{% if component.image %}
{% elsif component.image_url %}
{% else %}
{% endif %}
</td>
<td>
{% if component.product.title %}
{% assign component_title = component.product.title %}
{% else %}
{% assign component_title = component.title %}
{% endif %}
{% assign component_display = component.quantity %}
{{ component_title }} × {{ component_display }}
{% if component.variant.title != 'Default Title'%}
{{ component.variant.title }}
{% endif %}
</td>
</tr>
</table>
</table>
{% endfor %}
{% else %}
{% for group in line.groups %}
Part of: {{ group.display_title }}
{% endfor %}
{% endif %}
{% if line.gift_card and line.properties["__shopify_send_gift_card_to_recipient"] %}
{% for property in line.properties %}
{% assign property_first_char = property.first | slice: 0 %}
{% if property.last != blank and property_first_char != '_' %}
<dt>{{ property.first }}:</dt>
<dd>
{% if property.last contains '/uploads/' %}
{{ property.last | split: '/' | last }}
{% else %}
{{ property.last }}
{% endif %}
</dd>
{% endif %}
{% endfor %}
{% endif %}
{% if line.selling_plan_allocation %}
{{ line.selling_plan_allocation.selling_plan.name }}
{% endif %}
{% if line.refunded_quantity > 0 %}
Refunded
{% endif %}
{% if line.discount_allocations %}
{% for discount_allocation in line.discount_allocations %}
{% if discount_allocation.discount_application.target_selection != 'all' %}
{{ discount_allocation.discount_application.title | upcase }}
(-{{ discount_allocation.amount | money }})
{% endif %}
{% endfor %}
{% endif %}
{% else %}
{% endif %}
{% if line.original_line_price != line.final_line_price %}
<del>{{ line.original_line_price | money }}</del>
{% endif %}
{% if line.final_line_price > 0 %}
{{ line.final_line_price | money }}
{% else %}
Free
{% endif %}
</table>
</table>
<table>
<td>
</td>
{% assign total_order_discount_amount = 0 %}
{% assign has_shipping_discount = false %}
{% assign epsilon = 0.00001 %}
{% for discount_application in discount_applications %}
{% if discount_application.target_selection == 'all' and discount_application.target_type == 'line_item' %}
{% assign order_discount_count = order_discount_count | plus: 1 %}
{% assign total_order_discount_amount = total_order_discount_amount | plus: discount_application.total_allocated_amount %}
{% endif %}
{% if discount_application.target_type == 'shipping_line' %}
{% assign has_shipping_discount = true %}
{% assign shipping_discount_title = discount_application.title %}
{% if discount_application.total_allocated_amount == 0 %}
{% assign discount_value_price = discount_application.value | times: 100 %}
{% else %}
{% assign discount_value_price = discount_application.total_allocated_amount %}
{% endif %}
{% assign shipping_amount_minus_discount_value_price = shipping_price | minus: discount_value_price %}
{% assign shipping_amount_minus_discount_value_price_abs = shipping_amount_minus_discount_value_price | abs %}
{% assign discount_application_value_type = discount_application.value_type | strip %}
{% if shipping_amount_minus_discount_value_price_abs < epsilon or discount_application_value_type == 'percentage' and discount_application.value == 100 %}
{% assign free_shipping = true %}
{% else %}
{% assign discounted_shipping_price = shipping_amount_minus_discount_value_price %}
{% endif %}
{% endif %}
{% endfor %}
{% if order_discount_count > 0 %}
{% if order_discount_count == 1 %}
{% endif %}
{% if order_discount_count > 1 %}
{% endif %}
{% for discount_application in discount_applications %}
{% if discount_application.target_selection == 'all' and discount_application.target_type != 'shipping_line' %}
{% endif %}
{% endfor %}
{% endif %}
{% unless retail_delivery_only %}
{% if delivery_method == 'pick-up' %}
{% else %}
{% if has_shipping_discount %}
{% if free_shipping == true %}
{% else %}
{% endif %}
{% else %}
{% endif %}
{% endif %}
{% endunless %}
{% if total_duties %}
{% endif %}
{% if total_tip and total_tip > 0 %}
{% endif %}
<table>
<tr>
<td>
Subtotal
</td>
<td>
**{{ subtotal_price | plus: total_order_discount_amount | money }}**
</td>
</tr>
<tr>
<td>
Order discount
</td>
<td>
**-{{ total_order_discount_amount | money }}**
</td>
</tr>
<tr>
<td>
Order discounts
</td>
<td>
**-{{ total_order_discount_amount | money }}**
</td>
</tr>
<tr>
<td>
{{ discount_application.title }} (-{{ discount_application.total_allocated_amount | money }})
</td>
</tr>
<tr>
<td>
Pickup
</td>
<td>
**{{ shipping_price | money }}**
</td>
</tr>
<td>
Shipping
</td>
<del>{{ shipping_price | money}} </del>
**Free**
Shipping
<del>{{ shipping_price | money }} </del>
**{{ discounted_shipping_price | money }}**
{{ shipping_discount_title }} (-{{ discount_value_price | money }})
Shipping
**{{ shipping_price | money }}**
Duties
**{{ total_duties | money }}**
Taxes
**{{ tax_price | money }}**
Tip
**{{ total_tip | money }}**
</table>
{% assign transaction_size = 0 %}
{% assign transaction_amount = 0 %}
{% assign net_transaction_amount_rounding = 0 %}
{% for transaction in transactions %}
{% if transaction.status == "success" %}
{% if transaction.kind == "sale" or transaction.kind == "capture" %}
{% assign transaction_size = transaction_size | plus: 1 %}
{% assign transaction_amount = transaction_amount | plus: transaction.amount %}
{% if transaction.amount_rounding != nil %}
{% assign net_transaction_amount_rounding = net_transaction_amount_rounding | plus: transaction.amount_rounding %}
{% endif %}
{% elsif transaction.kind == "refund" or transaction.kind == "change" %}
{% assign transaction_size = transaction_size | plus: 1 %}
{% assign transaction_amount = transaction_amount | minus: transaction.amount %}
{% if transaction.amount_rounding != nil %}
{% assign net_transaction_amount_rounding = net_transaction_amount_rounding | minus: transaction.amount_rounding %}
{% endif %}
{% endif %}
{% endif %}
{% endfor %}
{% if payment_terms and payment_terms.automatic_capture_at_fulfillment == false or b2b? %}
{% assign next_payment = payment_terms.next_payment %}
{% assign due_at_date = next_payment.due_at | date: "%b %d, %Y" %}
{% if net_transaction_amount_rounding != 0 %}
{% endif %}
{% assign next_amount_due = total_price %}
{% if next_payment %}
{% assign next_amount_due = next_payment.amount_due %}
{% endif %}
{% if payment_terms.type == 'receipt' %}
{% elsif payment_terms.type == 'fulfillment' %}
{% else %}
{% endif %}
{% else %}
{% if net_transaction_amount_rounding != 0 %}
{% if financial_status == 'paid' %}
{% endif %}
{% endif %}
{% if transaction_amount != total_price and payment_terms == nil%}
{% endif %}
{% endif %}
<table>
<tr>
<td>
Total
</td>
<td>
**{{ total_price | money_with_currency }}**
</td>
</tr>
<tr>
<td colspan="2">
</td>
</tr>
<tr>
<td>
Cash rounding
</td>
<td>
**{% if net_transaction_amount_rounding < 0 %}-{% endif %} {{ net_transaction_amount_rounding | abs | money }}**
</td>
</tr>
<tr>
<td colspan="2">
</td>
</tr>
<tr>
<td>
Total paid today
</td>
<td>
**{{ transaction_amount | plus: net_transaction_amount_rounding | money_with_currency }}**
</td>
</tr>
<tr>
<td>
Total due on receipt
</td>
<td>
**{{ next_amount_due | money_with_currency }}**
</td>
</tr>
<tr>
<td>
Total due on fulfillment
</td>
<td>
**{{ next_amount_due | money_with_currency }}**
</td>
</tr>
<tr>
<td>
Total due {{ due_at_date }}
</td>
<td>
**{{ next_amount_due | money_with_currency }}**
</td>
</tr>
<tr>
<td>
Total
</td>
<td>
**{{ total_price | money_with_currency }}**
</td>
</tr>
<tr>
<td colspan="2">
</td>
</tr>
<tr>
<td>
Cash rounding
</td>
<td>
**{% if net_transaction_amount_rounding < 0 %}-{% endif %} {{ net_transaction_amount_rounding | abs | money }}**
</td>
</tr>
Paid
<small>{{ gateway | capitalize }}</small>
**{{ transaction_amount | plus: net_transaction_amount_rounding | money_with_currency }}**
Total paid today
**{{ transaction_amount | plus: net_transaction_amount_rounding | money_with_currency }}**
</table>
{% if total_discounts > 0 %}
You saved {{ total_discounts | money }}
{% endif %}
{% unless payment_terms %}
{% if transaction_size > 1 or transaction_amount < total_price %}
{% for transaction in transactions %}
{% assign amount_rounding = 0 %}
{% if transaction.amount_rounding != 0 %}
{% assign amount_rounding = transaction.amount_rounding %}
{% endif %}
{% if transaction.status == "success" and transaction.kind == "capture" or transaction.kind == "sale" %}
{% if transaction.payment_details.gift_card_last_four_digits %}
{% capture transaction_name %}Gift card (ending with {{ transaction.payment_details.gift_card_last_four_digits }}){% endcapture %}
{% elsif transaction.payment_details.credit_card_company %}
{% capture transaction_name %}{{ transaction.payment_details.credit_card_company }} (ending in {{ transaction.payment_details.credit_card_last_four_digits }}){% endcapture %}
{% else %}
{% capture transaction_name %}{{ transaction.gateway_display_name }}{% endcapture %}
{% endif %}
{% endif %}
{% if transaction.kind == 'refund' %}
{% if transaction.payment_details.gift_card_last_four_digits %}
{% assign refund_method_title = transaction.payment_details.type %}
{% elsif transaction.payment_details.credit_card_company %}
{% assign refund_method_title = transaction.payment_details.credit_card_company %}
{% else %}
{% assign refund_method_title = transaction.gateway_display_name %}
{% endif %}
{% endif %}
{% endfor %}
<table>
<tr>
<td colspan="2">
</td>
</tr>
<tr>
<td colspan="2">
</td>
</tr>
<tr>
<td>
{{transaction_name}}
</td>
<td>
**{{ transaction.amount | plus: amount_rounding | money }}**
</td>
</tr>
Refund
<small>{{ refund_method_title | replace: '_', ' ' | capitalize }}</small>
**- {{ transaction.amount | plus: amount_rounding | money }}**
</table>
{% endif %}
{% endunless %}
</table>
</table>
</table>
<table>
<table>
<tr>
<td>
### Customer information
</td>
</tr>
</table>
<table>
{% if requires_shipping and shipping_address %}
{% endif %}
{% if billing_address %}
{% endif %}
<table>
<tr>
<td>
#### Shipping address
{{ shipping_address | format_address }}
</td>
<td>
#### Billing address
{{ billing_address | format_address }}
</td>
</tr>
</table>
{% if company_location %}
{% endif %}
{% if transaction_size > 0 or payment_terms and payment_terms.automatic_capture_at_fulfillment == false or b2b? %}
{% endif %}
{% if requires_shipping and shipping_address %}
{% if shipping_method %}
{% endif %}
{% endif %}
<table>
<tr>
<td>
#### Location
{{ company_location.name }}
</td>
<td>
#### Payment
{% if payment_terms %}
{% assign due_date = payment_terms.next_payment.due_at | default: nil %}
{% if payment_terms.type == 'receipt' or payment_terms.type == 'fulfillment' and payment_terms.next_payment.due_at == nil %}
{{ payment_terms.translated_name }}
{% else %}
{{ payment_terms.translated_name }}: Due {{ due_date | date: format: 'date' }}
{% endif %}
{% endif %}
{% if transaction_size > 0 %}
{% for transaction in transactions %}
{% if transaction.status == "success" or transaction.status == "pending" %}
{% if transaction.kind == "capture" or transaction.kind == "sale" %}
{% if transaction.payment_details.gift_card_last_four_digits %}
ending with {{ transaction.payment_details.gift_card_last_four_digits }}
{% elsif transaction.payment_details.credit_card_company %}
ending with {{ transaction.payment_details.credit_card_last_four_digits }}
{% elsif transaction.gateway_display_name == "Gift card" %}
ending with {{ transaction.payment_details.gift_card.last_four_characters | upcase }}
Gift card balance - **{{ transaction.payment_details.gift_card.balance | money }}**
{% elsif transaction.gateway_display_name != "Shop Cash" %}
{{ transaction.gateway_display_name }}
{% endif %}
{% elsif transaction.kind == "authorization" and transaction.gateway_display_name == "Shop Cash" %}
Shop Cash
{% endif %}
{% endif %}
{% endfor %}
{% endif %}
</td>
</tr>
<tr>
<td>
#### Shipping method
{% if delivery_promise_branded_shipping_line %}
{{ delivery_promise_branded_shipping_line }}
{% else %}
{{ shipping_method.title }}
{% endif %}
</td>
</tr>
</table>
</table>
</table>
<table>
<table>
<tr>
<td>
If you have any questions, reply to this email or contact us at [{{ shop.email }}](mailto:{{ shop.email }})
</td>
</tr>
</table>
</table>
</table>
{%- if billing_address.country_code == 'DE' or billing_address.country_code == 'DK' -%}
{%- if shop.terms_of_service.body != blank -%}
{{ shop.terms_of_service | attach_as_pdf: "Terms of service" }}
{%- endif -%}
{%- if shop.refund_policy.body != blank -%}
{{ shop.refund_policy | attach_as_pdf: "Refund policy" }}
{%- endif -%}
{%- endif -%}
2、draft order invoice
{% capture email_title %}
{% if payment_terms %}
Review and confirm to complete your order
{% else %}
Complete your purchase
{% endif %}
{% endcapture %}
{% capture email_body %}
{% if item_count > 1 %}
These items will be reserved for you until {{ reserve_inventory_until | date: format: 'date_at_time' }}.
{% else %}
This item will be reserved for you until {{ reserve_inventory_until | date: format: 'date_at_time' }}.
{% endif %}
{% endcapture %}
<table>
<table>
<table>
<table>
<td>
{%- if shop.email_logo_url %}
{%- else %}
#
{{ shop.name }}
{%- endif %}
</td>
{%- if po_number %}
{%- endif %}
<table>
<tr>
<td>
Invoice {{ name }}
</td>
</tr>
<tr>
<td>
PO number #{{ po_number }}
</td>
</tr>
</table>
</table>
</table>
</table>
<table>
<table>
## {{ email_title }}
{% if custom_message != blank %}
{{ custom_message }}
{% elsif reserve_inventory_until %}
{{ email_body }}
{% endif %}
{% if payment_terms %}
<table>
<tr>
<td>
</td>
</tr>
<table>
<tr>
<td>
Confirm order
</td>
</tr>
</table>
{% if shop.url %}
<table>
<tr>
<td>
or Visit our store
</td>
</tr>
</table>
{% endif %}
</table>
{% else %}
<table>
<tr>
<td>
</td>
</tr>
<table>
<tr>
<td>
Complete your purchase
</td>
</tr>
</table>
{% if shop.url %}
<table>
<tr>
<td>
or Visit our store
</td>
</tr>
</table>
{% endif %}
</table>
{% endif %}
</table>
</table>
<table>
<table>
<tr>
<td>
### Order summary
</td>
</tr>
</table>
<table>
{% for line in subtotal_line_items %}
{% endfor %}
<table>
{% assign expand_bundles = true %}
{% if expand_bundles and line.bundle_parent? %}
{% else %}
{% endif %}
{% if expand_bundles and line.bundle_parent? %}
<table>
<td>
{% if line.image %}
{% else %}
{% endif %}
</td>
<td>
{% if line.image %}
{% else %}
{% endif %}
</td>
{% if line.product.title %}
{% assign line_title = line.product.title %}
{% else %}
{% assign line_title = line.title %}
{% endif %}
{% if line.quantity < line.quantity %}
{% capture line_display %}
{{ line.quantity }} of {{ line.quantity }}
{% endcapture %}
{% else %}
{% assign line_display = line.quantity %}
{% endif %}
{{ line_title }} × {{ line_display }}
{% if line.variant.title != 'Default Title' and line.bundle_parent? == false %}
{{ line.variant.title }}
{% elsif line.variant.title != 'Default Title' and line.bundle_parent? and expand_bundles == false %}
{{ line.variant.title }}
{% endif %}
{% if expand_bundles %}
{% for component in line.bundle_components %}
<table>
<table>
<tr>
<td>
{% if component.image %}
{% elsif component.image_url %}
{% else %}
{% endif %}
</td>
<td>
{% if component.product.title %}
{% assign component_title = component.product.title %}
{% else %}
{% assign component_title = component.title %}
{% endif %}
{% assign component_display = component.quantity %}
{{ component_title }} × {{ component_display }}
{% if component.variant.title != 'Default Title'%}
{{ component.variant.title }}
{% endif %}
</td>
</tr>
</table>
</table>
{% endfor %}
{% else %}
{% for group in line.groups %}
Part of: {{ group.display_title }}
{% endfor %}
{% endif %}
{% if line.gift_card and line.properties["__shopify_send_gift_card_to_recipient"] %}
{% for property in line.properties %}
{% assign property_first_char = property.first | slice: 0 %}
{% if property.last != blank and property_first_char != '_' %}
<dt>{{ property.first }}:</dt>
<dd>
{% if property.last contains '/uploads/' %}
{{ property.last | split: '/' | last }}
{% else %}
{{ property.last }}
{% endif %}
</dd>
{% endif %}
{% endfor %}
{% endif %}
{% if line.selling_plan_allocation %}
{{ line.selling_plan_allocation.selling_plan.name }}
{% endif %}
{% if line.refunded_quantity > 0 %}
Refunded
{% endif %}
{% if line.discount_allocations %}
{% for discount_allocation in line.discount_allocations %}
{% if discount_allocation.discount_application.target_selection != 'all' %}
{{ discount_allocation.discount_application.title | upcase }}
(-{{ discount_allocation.amount | money }})
{% endif %}
{% endfor %}
{% endif %}
{% else %}
{% endif %}
{% if line.original_line_price != line.final_line_price %}
<del>{{ line.original_line_price | money }}</del>
{% endif %}
{% if line.final_line_price > 0 %}
{{ line.final_line_price | money }}
{% else %}
Free
{% endif %}
</table>
</table>
<table>
<td>
</td>
{% assign order_discount_count = 0 %}
{% assign total_order_discount_amount = 0 %}
{% assign subtotal_order_amount = 0 %}
{% assign has_shipping_discount = false %}
{% for discount_application in discount_applications %}
{% if discount_application.target_selection == 'all' and discount_application.target_type == 'line_item' %}
{% assign order_discount_count = order_discount_count | plus: 1 %}
{% assign total_order_discount_amount = total_order_discount_amount | plus: discount_application.total_allocated_amount %}
{% assign subtotal_order_amount = subtotal_order_amount | plus: discount_application.total_allocated_amount %}
{% endif %}
{% if discount_application.target_type == 'shipping_line' %}
{% assign has_shipping_discount = true %}
{% assign shipping_discount = discount_application.title %}
{% assign shipping_amount = discount_application.total_allocated_amount %}
{% assign subtotal_order_amount = subtotal_order_amount | plus: discount_application.total_allocated_amount %}
{% assign discounted_shipping_price = shipping_price | minus: shipping_amount %}
{% endif %}
{% endfor %}
{% if order_discount_count > 0 %}
{% if order_discount_count == 1 %}
{% else %}
{% endif %}
{% for discount_application in discount_applications %}
{% if discount_application.target_selection == 'all' and discount_application.target_type != 'shipping_line' %}
{% endif %}
{% endfor %}
{% endif %}
{% if delivery_method == 'pick-up' %}
{% else %}
{% if has_shipping_discount %}
{% if discounted_shipping_price > 0 %}
{% else %}
{% endif %}
{% else %}
{% endif %}
{% endif %}
{% if total_duties %}
{% endif %}
{% if total_tip and total_tip > 0 %}
{% endif %}
<table>
<tr>
<td>
Subtotal
</td>
<td>
**{{ subtotal_price | plus: subtotal_order_amount | money }}**
</td>
</tr>
<tr>
<td>
Order discount
</td>
<td>
**-{{ total_order_discount_amount | money }}**
</td>
</tr>
<tr>
<td>
Order discounts
</td>
<td>
**-{{ total_order_discount_amount | money }}**
</td>
</tr>
<tr>
<td>
{{ discount_application.title }} (-{{ discount_application.total_allocated_amount | money }})
</td>
</tr>
<tr>
<td>
Pickup
</td>
<td>
**{{ shipping_price | money }}**
</td>
</tr>
<tr>
<td>
Shipping
</td>
<td>
**{{ discounted_shipping_price | money }}**
</td>
</tr>
<tr>
<td>
{{ shipping_discount }} (-{{ shipping_amount | money }})
</td>
</tr>
<tr>
<td>
Shipping
</td>
<td>
**Free**
</td>
</tr>
<tr>
<td>
{{ shipping_discount }} (-{{ shipping_amount | money }})
</td>
</tr>
<tr>
<td>
Shipping
</td>
<td>
**{{ shipping_price | money }}**
</td>
</tr>
<tr>
<td>
Duties
</td>
<td>
**{{ total_duties | money }}**
</td>
</tr>
<tr>
<td>
Estimated taxes
</td>
<td>
**{{ tax_price | money }}**
</td>
</tr>
<tr>
<td>
Tip
</td>
<td>
**{{ total_tip | money }}**
</td>
</tr>
</table>
{% if payment_terms %}
{% assign next_payment = payment_terms.next_payment %}
{% assign due_at_date = next_payment.due_at | date: format: 'date' %}
{% assign next_amount_due = total_price | minus: amount_due_now %}
{% if payment_terms.type == 'receipt' %}
{% elsif payment_terms.type == 'fulfillment' %}
{% else %}
{% endif %}
{% else %}
{% endif %}
<table>
<tr>
<td>
Total due today
</td>
<td>
**{{ amount_due_now | money_with_currency }}**
</td>
</tr>
<tr>
<td>
Total due on receipt
</td>
<td>
**{{ next_amount_due | money_with_currency }}**
</td>
</tr>
<tr>
<td>
Total due on fulfillment
</td>
<td>
**{{ next_amount_due | money_with_currency }}**
</td>
</tr>
<tr>
<td>
Total due {{ due_at_date }}
</td>
<td>
**{{ next_amount_due | money_with_currency }}**
</td>
</tr>
<tr>
<td>
Total
</td>
<td>
**{{ total_price | money_with_currency }}**
</td>
</tr>
</table>
{% if total_discounts > 0 %}
You saved {{ total_discounts | money }}
{% endif %}
{% unless payment_terms %}
{% endunless %}
</table>
</table>
</table>
{% if shipping_address or billing_address or shipping_method or company_location or payment_terms %}
<table>
<table>
<tr>
<td>
### Customer information
</td>
</tr>
</table>
<table>
{% if shipping_address %}
{% endif %}
{% if billing_address %}
{% endif %}
<table>
<tr>
<td>
#### Shipping address
{{ shipping_address | format_address }}
</td>
<td>
#### Billing address
{{ billing_address | format_address }}
</td>
</tr>
</table>
{% if shipping_method or company_location or payment_terms %}
{% if company_location %}
{% endif %}
{% if payment_terms %}
{% endif %}
{% if shipping_method %}
{% endif %}
<table>
<tr>
<td>
#### Location
{{ company_location.name }}
</td>
<td>
#### Payment
{% assign due_date = payment_terms.next_payment.due_at | default: nil %}
{% if payment_terms.type == 'receipt' or payment_terms.type == 'fulfillment' %}
{{ payment_terms.translated_name }}
{% else %}
{{ payment_terms.translated_name }}: Due {{ due_date | date: format: 'date' }}
{% endif %}
</td>
</tr>
<tr>
<td>
#### Shipping method
{% if local_pickup %}
Local pickup - {{ shipping_method.title }}
{% if local_pickup_address %}
{{ local_pickup_address | format_address }}
{% endif %}
{% else %}
{{ shipping_method.title }}
{{ shipping_method.price | money }}
{% endif %}
</td>
<td>
</td>
</tr>
</table>
{% endif %}
</table>
</table>
{% endif %}
<table>
<table>
<tr>
<td>
If you have any questions, reply to this email or contact us at [{{ shop.email }}](mailto:{{ shop.email }})
</td>
</tr>
</table>
</table>
</table>

