File tree Expand file tree Collapse file tree 3 files changed +91
-14
lines changed Expand file tree Collapse file tree 3 files changed +91
-14
lines changed Original file line number Diff line number Diff line change 164
164
"sale_price" : " Sale price" ,
165
165
"unit_price" : " Unit price"
166
166
},
167
+ "unit_price" : {
168
+ "per_item" : {
169
+ "single" : " {{price}} each" ,
170
+ "one" : " {{price}} per {{count}} item" ,
171
+ "other" : " {{price}} per {{count}} items"
172
+ },
173
+ "per_unit" : " {{price}} / {{count}}{{unit}}" ,
174
+ "per_unit_accessibility" : " {{price}} per {{count}}{{unit}}" ,
175
+ "unit" : {
176
+ "mg" : " mg" ,
177
+ "g" : " g" ,
178
+ "kg" : " kg" ,
179
+ "ml" : " ml" ,
180
+ "cl" : " cl" ,
181
+ "l" : " L" ,
182
+ "m3" : " m³" ,
183
+ "mm" : " mm" ,
184
+ "cm" : " cm" ,
185
+ "m" : " m" ,
186
+ "m2" : " m²" ,
187
+ "oz" : " oz" ,
188
+ "lb" : " lb" ,
189
+ "floz" : " fl oz" ,
190
+ "pt" : " pt" ,
191
+ "qt" : " qt" ,
192
+ "gal" : " gal" ,
193
+ "in" : " in" ,
194
+ "ft" : " ft" ,
195
+ "yd" : " yd" ,
196
+ "ft2" : " ft²" ,
197
+ "item" : " item"
198
+ }
199
+ },
167
200
"share" : " Share this product" ,
168
201
"sold_out" : " Sold out" ,
169
202
"unavailable" : " Unavailable" ,
Original file line number Diff line number Diff line change 108
108
{{ money_price }}
109
109
</span >
110
110
</div >
111
- <small class =" unit-price caption{% if product .selected_or_first_available_variant .unit_price_measurement == nil %} hidden{% endif %}" >
112
- <span class =" visually-hidden" >{{ 'products.product.price.unit_price' | t }}</span >
113
- <span class =" price-item price-item--last" >
114
- <span >{{- product .selected_or_first_available_variant .unit_price | money -}}</span >
115
- <span aria-hidden =" true" >/</span >
116
- <span class =" visually-hidden" >  ; {{ 'accessibility.unit_price_separator' | t }}  ; </span >
117
- <span >
118
- {%- if product .selected_or_first_available_variant .unit_price_measurement .reference_value != 1 -%}
119
- {{- product .selected_or_first_available_variant .unit_price_measurement .reference_value -}}
120
- {%- endif -%}
121
- {{ product .selected_or_first_available_variant .unit_price_measurement .reference_unit }}
122
- </span >
123
- </span >
124
- </small >
111
+ {%- if use_variant -%}
112
+ {% render 'unit-price' , variant: target %}
113
+ {%- endif -%}
125
114
</div >
126
115
{%- if show_badges -%}
127
116
<span class =" badge price__badge-sale color-{{ settings .sale_badge_color_scheme }}" >
Original file line number Diff line number Diff line change
1
+ {%- assign measurement = variant .unit_price_measurement -%}
2
+ <small class =" unit-price caption{% if measurement == nil %} hidden{% endif %}" >
3
+ <span class =" visually-hidden" >{{ 'products.product.price.unit_price' | t }}</span >
4
+ <span class =" price-item price-item--last" >
5
+ {%- assign price = variant .unit_price | money -%}
6
+ {%- if measurement .measured_type == 'count' -%}
7
+ {%- assign count = measurement .reference_value -%}
8
+ {%- if measurement .reference_value == 1 -%}
9
+ {{- 'products.product.unit_price.per_item.single' | t: price: price -}}
10
+ {%- else -%}
11
+ {{- 'products.product.unit_price.per_item' | t: price: price , count: count -}}
12
+ {%- endif -%}
13
+ {%- else -%}
14
+ {%- case measurement .reference_unit -%}
15
+ {%- when 'ml' ,
16
+ 'cl' ,
17
+ 'l' ,
18
+ 'm3' ,
19
+ 'pt' ,
20
+ 'qt' ,
21
+ 'gal' ,
22
+ 'floz' ,
23
+ 'mg' ,
24
+ 'g' ,
25
+ 'kg' ,
26
+ 'oz' ,
27
+ 'lb' ,
28
+ 'mm' ,
29
+ 'cm' ,
30
+ 'm' ,
31
+ 'ft' ,
32
+ 'yd' ,
33
+ 'in' ,
34
+ 'm2' ,
35
+ 'ft2' ,
36
+ 'item'
37
+ -%}
38
+ {% comment %}theme-check-disable TranslationKeyExists{% endcomment %}
39
+ {%- assign unit = 'products.product.unit_price.unit.' | append: measurement .reference_unit | t -%}
40
+ {% comment %}theme-check-enable TranslationKeyExists{% endcomment %}
41
+ {%- else -%}
42
+ {%- assign unit = measurement .reference_unit -%}
43
+ {%- endcase -%}
44
+ {%- if measurement .reference_value != 1 -%}
45
+ {%- assign count = measurement .reference_value -%}
46
+ {%- endif -%}
47
+ <span aria-hidden =" true" >
48
+ {{- 'products.product.unit_price.per_unit' | t: price: price , count: count , unit: unit -}}
49
+ </span >
50
+ <span class =" visually-hidden" >
51
+ {{- 'products.product.unit_price.per_unit_accessibility' | t: price: price , count: count , unit: unit -}}
52
+ </span >
53
+ {%- endif -%}
54
+ </span >
55
+ </small >
You can’t perform that action at this time.
0 commit comments