Add compare at price
Add compare at price
This commit is contained in:
@@ -122,9 +122,9 @@ Supported variables
|
|||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
|
|
||||||
{%- if show_prices and product.template_suffix != 'quote' -%}
|
{%- if show_prices and product.template_suffix != 'quote' -%}
|
||||||
<div class="product-price">
|
|
||||||
{% assign v = product.selected_or_first_available_variant %}
|
{% assign v = product.selected_or_first_available_variant %}
|
||||||
{% assign variant_price = product.selected_or_first_available_variant.price %}
|
{% assign variant_price = v.price %}
|
||||||
|
{% assign variant_compare_at_price = v.compare_at_price %}
|
||||||
{% if v.metafields.app--168074346497.discount_type.value != nil and v.metafields.app--168074346497.discount_type.value != "fixed" and product.metafields.app--168074346497.discount_percentage.value > 0.01 %}
|
{% if v.metafields.app--168074346497.discount_type.value != nil and v.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 %}
|
{% assign deducted_percentage = 1.0 | minus: product.metafields.app--168074346497.discount_percentage.value %}
|
||||||
|
|
||||||
@@ -133,10 +133,20 @@ Supported variables
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% assign variant_price = v.price | divided_by: 100.0 | times: deducted_percentage | times: 100.0 | ceil %}
|
{% assign variant_price = v.price | divided_by: 100.0 | times: deducted_percentage | times: 100.0 | ceil %}
|
||||||
|
{% assign variant_compare_at_price = v.price %}
|
||||||
|
{% if v.compare_at_price > variant_compare_at_price %}
|
||||||
|
{% assign variant_compare_at_price = v.compare_at_price %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
<div class="product-price">
|
||||||
{{ variant_price | money }}
|
{{ variant_price | money }}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{% if variant_compare_at_price %}
|
||||||
|
<compare-at-price class="text-subdued line-through">
|
||||||
|
{{ variant_compare_at_price | money }}
|
||||||
|
</compare-at-price>
|
||||||
|
{% endif %}
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -305,4 +315,3 @@ Supported variables
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user