83 lines
3.8 KiB
Plaintext
83 lines
3.8 KiB
Plaintext
{% liquid
|
|||
|
|
assign variant_price = variant.metafields.app--168074346497.auto_discounted_price.value | default: variant.price
|
||
|
|
assign variant_compare_at_price = variant.compare_at_price
|
||
|
|
|
||
|
|
if variant.metafields.app--168074346497.discount_type.value != nil and variant.metafields.app--168074346497.discount_type.value != "fixed" and product.metafields.app--168074346497.discount_percentage.value > 0.01
|
||
|
|
assign deducted_percentage = 1.0 | minus: product.metafields.app--168074346497.discount_percentage.value
|
||
|
|
|
||
|
|
if variant.metafields.app--168074346497.discount_percentage.value > 0.01
|
||
|
|
assign deducted_percentage = 1.0 | minus: variant.metafields.app--168074346497.discount_percentage.value
|
||
|
|
endif
|
||
|
|
|
||
|
|
assign variant_price = variant.price | divided_by: 100.0 | times: deducted_percentage | times: 100.0 | ceil
|
||
|
|
|
||
|
|
assign variant_compare_at_price = variant.price
|
||
|
|
|
||
|
|
if variant.compare_at_price > compare_at_price
|
||
|
|
assign variant_compare_at_price = variant.compare_at_price
|
||
|
|
endif
|
||
|
|
endif
|
||
|
|
|
||
|
|
if shop.metafields.app--168074346497.discount_percentage.value > 0.005
|
||
|
|
assign discount_percentage = shop.metafields.app--168074346497.discount_percentage.value | times: 1.0
|
||
|
|
assign deducted_percentage = 1.0 | minus: discount_percentage
|
||
|
|
|
||
|
|
assign variant_price = variant.price | divided_by: 100.0 | times: deducted_percentage | times: 100.0 | ceil
|
||
|
|
|
||
|
|
assign variant_compare_at_price = variant.price
|
||
|
|
|
||
|
|
if variant.compare_at_price > compare_at_price
|
||
|
|
assign variant_compare_at_price = variant.compare_at_price
|
||
|
|
endif
|
||
|
|
endif
|
||
|
|
|
||
|
|
if variant_price < variant.price and variant_compare_at_price == blank
|
||
|
|
assign variant_compare_at_price = variant.price
|
||
|
|
endif
|
||
|
|
%}
|
||
|
|
<div class="price-container{% if variant.unit_price_measurement %} price-container--unit-available{% endif %}" data-price-container>
|
||
|
|
{%- if variant_compare_at_price > variant_price -%}
|
||
|
|
<span id="PriceA11y" class="visually-hidden">{{ 'products.general.regular_price' | t }}</span>
|
||
|
|
<span class="product-single__price--wrapper" aria-hidden="false">
|
||
|
|
<span id="ComparePrice" class="product-single__price--compare-at">
|
||
|
|
{{ variant_compare_at_price | money }}
|
||
|
|
</span>
|
||
|
|
</span>
|
||
|
|
<span id="ComparePriceA11y" class="visually-hidden" aria-hidden="false">{{ 'products.general.sale_price' | t }}</span>
|
||
|
|
{%- else -%}
|
||
|
|
<span id="PriceA11y" class="visually-hidden">{{ 'products.general.regular_price' | t }}</span>
|
||
|
|
<span class="product-single__price--wrapper hide" aria-hidden="true">
|
||
|
|
<span id="ComparePrice" class="product-single__price--compare-at"></span>
|
||
|
|
</span>
|
||
|
|
<span id="ComparePriceA11y" class="visually-hidden" aria-hidden="true">{{ 'products.general.sale_price' | t }}</span>
|
||
|
|
{%- endif -%}
|
||
|
|
|
||
|
|
<span id="ProductPrice"
|
||
|
|
class="product-single__price{% if variant_compare_at_price > variant_price %} on-sale{% endif %}"
|
||
|
|
itemprop="price"
|
||
|
|
content="{{ variant_price | divided_by: 100.00 }}">
|
||
|
|
{{ variant_price | money }}
|
||
|
|
</span>
|
||
|
|
|
||
|
|
<div class="product-single__unit">
|
||
|
|
{%- capture unit_price_separator -%}
|
||
|
|
<span aria-hidden="true">/</span><span class="visually-hidden"> {{ 'general.accessibility.unit_price_separator' | t }} </span>
|
||
|
|
{%- endcapture -%}
|
||
|
|
|
||
|
|
{%- capture unit_price_base_unit -%}
|
||
|
|
<span data-unit-price-base-unit>
|
||
|
|
{%- if variant.unit_price_measurement -%}
|
||
|
|
{%- if variant.unit_price_measurement.reference_value != 1 -%}
|
||
|
|
{{- variant.unit_price_measurement.reference_value -}}
|
||
|
|
{%- endif -%}
|
||
|
|
{{ variant.unit_price_measurement.reference_unit }}
|
||
|
|
{%- endif -%}
|
||
|
|
</span>
|
||
|
|
{%- endcapture -%}
|
||
|
|
<span class="product-unit-price">
|
||
|
|
<span class="visually-hidden">{{ 'products.general.unit_price' | t }}</span>
|
||
|
|
<span data-unit-price>{{ variant.unit_price | money }}</span>{{- unit_price_separator -}}{{- unit_price_base_unit -}}
|
||
|
|
</span>
|
||
|
|
</div>
|
||
|
|
</div>
|