-
Notifications
You must be signed in to change notification settings - Fork 0
/
order-refund.liquid
196 lines (170 loc) · 6.23 KB
/
order-refund.liquid
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
{% if refund_line_items.size == item_count %}
{% capture email_title %}Your order has been refunded{% endcapture %}
{% elsif refund_line_items.size == 0 %}
{% capture email_title %}You have received a refund{% endcapture %}
{% else %}
{% capture email_title %}Some items in your order have been refunded{% endcapture %}
{% endif %}
{% capture email_body %}Total amount refunded: <strong>{{ amount | money_with_currency }}</strong>{% endcapture %}
<!DOCTYPE html>
<html lang="en">
<head>
<title>{{ email_title }}</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width">
<style>
.button { background: {{ shop.email_accent_color }}; }
a, a:hover, a:active, a:visited { color: {{ shop.email_accent_color }}; }
</style>
</head>
<body>
{%- if shop.email_logo_url %}
<img src="{{ shop.email_logo_url }}" alt="{{ shop.name }}" width="{{ shop.email_logo_width }}">
{%- else %}
<h1>
<a href="{{ shop.url }}">{{ shop.name }}</a>
</h1>
{%- endif %}
<h2>Order {{ order_name }}</h2>
<h2>{{ email_title }}</h2>
<p>{{ email_body }}</p>
<h3>Order summary</h3>
{% for line in subtotal_line_items %}
{% if line.image %}
<img src="{{ line | img_url: 'compact_cropped' }}" align="left" width="60" height="60" />
{% endif %}
{% 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' %}
{{ line.variant.title }}
{% 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' %}
<img src="{{ 'notifications/discounttag.png' | shopify_asset_url }}" width="18" height="18" />
{{ discount_allocation.discount_application.title | upcase }}
(-{{ discount_allocation.amount | money }})
{% endif %}
{% endfor %}
{% endif %}
{% if line.original_line_price != line.final_line_price %}
<del>{{ line.original_line_price | money }}</del>
{% endif %}
<p>
{% if line.final_line_price > 0 %}
{{ line.final_line_price | money }}
{% else %}
Free
{% endif %}
</p>
{% endfor %}
{% for discount_application in discount_applications %}
{% if discount_application.target_selection == 'all' %}
{% capture discount_title %}
{% if discount_application.title %}
{{ discount_application.title | upcase }}
{% else %}
Discount
{% endif %}
{% endcapture %}
<p>
Discount
<img src="{{ 'notifications/discounttag.png' | shopify_asset_url }}" width="18" height="18" />
{{ discount_title }}
</p>
<strong>-{{ discount_application.total_allocated_amount | money }}</strong>
{% endif %}
{% endfor %}
<p>
Subtotal
</p>
<strong>{{ subtotal_price | money }}</strong>
{% if delivery_method == 'pick-up' %}
<p>
Pickup
</p>
<strong>{{ shipping_price | money }}</strong>
{% else %}
<p>
Shipping
</p>
<strong>{{ shipping_price | money }}</strong>
{% endif %}
{% if current_total_duties %}
<p>
Duties
</p>
<strong>{{ current_total_duties | money }}</strong>
{% endif %}
<p>
Taxes
</p>
<strong>{{ tax_price | money }}</strong>
{% if total_tip and total_tip > 0 %}
<p>
Tip
</p>
<strong>{{ total_tip | money }}</strong>
{% endif %}
<p>
Total
</p>
<strong>{{ total_price | money_with_currency }}</strong>
{% if total_discounts > 0 %}
<p>
You saved {{ total_discounts | money }}
</p>
{% endif %}
{% assign transaction_size = 0 %}
{% assign transaction_amount = 0 %}
{% for transaction in transactions %}
{% unless transaction.kind == "capture" or transaction.kind == "void" %}
{% assign transaction_size = transaction_size | plus: 1 %}
{% assign transaction_amount = transaction_amount | plus: transaction.amount %}
{% endunless %}
{% endfor %}
{% if transaction_size > 1 or transaction_amount < total_price %}
{% for transaction in transactions %}
{% if transaction.status == "success" and transaction.kind == "authorization" or transaction.kind == "sale" %}
{% if 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 %}
<p>
{{ transaction_name }}
</p>
<strong>{{ transaction.amount | money }}</strong>
{% endif %}
{% if transaction.kind == 'refund' %}
{% if transaction.payment_details.credit_card_company %}
{% assign refund_method_title = transaction.payment_details.credit_card_company %}
{% else %}
{% assign refund_method_title = transaction.gateway %}
{% endif %}
<p>
Refund
{{ refund_method_title | capitalize }}
</p>
<strong>- {{ transaction.amount | money }}</strong>
{% endif %}
{% endfor %}
{% endif %}
<p>If you have any questions, reply to this email or contact us at <a href="mailto:{{ shop.email }}">{{ shop.email }}</a></p>
</body>
</html>