Yagi discounted price modification
This commit is contained in:
@@ -41,6 +41,49 @@
|
||||
endif
|
||||
-%}
|
||||
|
||||
{% liquid
|
||||
comment
|
||||
start Yagi app code
|
||||
endcomment
|
||||
assign card_product_price = card_product.price
|
||||
assign card_product_compare_at_price = card_product.compare_at_price
|
||||
|
||||
assign card_product_price = card_product.metafields.app--168074346497.min_auto_discounted_price.value | default: card_product.price
|
||||
|
||||
if card_product.metafields.app--168074346497.discount_percentage.value > 0.01
|
||||
assign deducted_percentage = 1.0 | minus: card_product.metafields.app--168074346497.discount_percentage.value
|
||||
|
||||
assign card_product_price = card_product.price | divided_by: 100.0 | times: deducted_percentage | times: 100.0 | ceil
|
||||
|
||||
assign card_product_compare_at_price = card_product.price
|
||||
|
||||
if card_product.compare_at_price > card_product_compare_at_price
|
||||
assign card_product_compare_at_price = card_product.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 card_product_price = card_product.price | divided_by: 100.0 | times: deducted_percentage | times: 100.0 | ceil
|
||||
|
||||
assign card_product_compare_at_price = card_product.price
|
||||
|
||||
if card_product.compare_at_price > card_product_compare_at_price
|
||||
assign card_product_compare_at_price = card_product.compare_at_price
|
||||
endif
|
||||
endif
|
||||
|
||||
if card_product_price < card_product.price and card_product_compare_at_price == blank
|
||||
assign card_product_compare_at_price = card_roduct.price
|
||||
endif
|
||||
|
||||
comment
|
||||
end Yagi app code
|
||||
endcomment
|
||||
%}
|
||||
|
||||
<product-component view-event-payload="{{ card_product | standard_event_data: 'view', context: product_view_context | escape }}">
|
||||
<div class="card-wrapper product-card-wrapper underline-links-hover">
|
||||
<div
|
||||
@@ -120,7 +163,7 @@
|
||||
href="{{ card_product.url }}"
|
||||
id="StandardCardNoMediaLink-{{ section_id }}-{{ card_product.id }}"
|
||||
class="full-unstyled-link"
|
||||
aria-labelledby="StandardCardNoMediaLink-{{ section_id }}-{{ card_product.id }}{% if card_product.available == false or card_product.compare_at_price > card_product.price %} NoMediaStandardBadge-{{ section_id }}-{{ card_product.id }}{% endif %}"
|
||||
aria-labelledby="StandardCardNoMediaLink-{{ section_id }}-{{ card_product.id }}{% if card_product.available == false or card_product_compare_at_price > card_product_price %} NoMediaStandardBadge-{{ section_id }}-{{ card_product.id }}{% endif %}"
|
||||
>
|
||||
{{ card_product.title | escape }}
|
||||
</a>
|
||||
@@ -134,7 +177,7 @@
|
||||
>
|
||||
{{- 'products.product.sold_out' | t -}}
|
||||
</span>
|
||||
{%- elsif card_product.compare_at_price > card_product.price and card_product.available -%}
|
||||
{%- elsif card_product_compare_at_price > card_product_price and card_product.available -%}
|
||||
<span
|
||||
id="NoMediaStandardBadge-{{ section_id }}-{{ card_product.id }}"
|
||||
class="badge badge--bottom-left color-{{ settings.sale_badge_color_scheme }}"
|
||||
@@ -157,7 +200,7 @@
|
||||
href="{{ card_product.url }}"
|
||||
id="CardLink-{{ section_id }}-{{ card_product.id }}"
|
||||
class="full-unstyled-link"
|
||||
aria-labelledby="CardLink-{{ section_id }}-{{ card_product.id }}{% if card_product.available == false or card_product.compare_at_price > card_product.price %} Badge-{{ section_id }}-{{ card_product.id }}{% endif %}"
|
||||
aria-labelledby="CardLink-{{ section_id }}-{{ card_product.id }}{% if card_product.available == false or card_product_compare_at_price > card_product_price %} Badge-{{ section_id }}-{{ card_product.id }}{% endif %}"
|
||||
>
|
||||
{{ card_product.title | escape }}
|
||||
</a>
|
||||
@@ -558,7 +601,7 @@
|
||||
>
|
||||
{{- 'products.product.sold_out' | t -}}
|
||||
</span>
|
||||
{%- elsif card_product.compare_at_price > card_product.price and card_product.available -%}
|
||||
{%- elsif card_product_compare_at_price > card_product_price and card_product.available -%}
|
||||
<span
|
||||
id="Badge-{{ section_id }}-{{ card_product.id }}"
|
||||
class="badge badge--bottom-left color-{{ settings.sale_badge_color_scheme }}"
|
||||
|
||||
Reference in New Issue
Block a user