fix product-card
This commit is contained in:
@@ -284,6 +284,63 @@
|
||||
</h3>
|
||||
</div>
|
||||
<div class="card__badge {{ settings.badge_position }}">
|
||||
{% liquid
|
||||
assign card_product_compare_at_price = card_product.compare_at_price
|
||||
assign card_product_price = card_product.price
|
||||
|
||||
comment
|
||||
start Yagi app code
|
||||
endcomment
|
||||
assign public_or_tags_matched = true
|
||||
|
||||
if product.metafields.app--168074346497.segment_tags.value.size > 0
|
||||
assign public_or_tags_matched = false
|
||||
endif
|
||||
|
||||
for etag in product.metafields.app--168074346497.segment_tags.value
|
||||
if customer.tags contains etag
|
||||
assign public_or_tags_matched = true
|
||||
break
|
||||
endif
|
||||
endfor
|
||||
|
||||
if public_or_tags_matched
|
||||
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_product.price
|
||||
endif
|
||||
endif
|
||||
|
||||
comment
|
||||
end Yagi app code
|
||||
endcomment
|
||||
%}
|
||||
{%- if card_product.available == false -%}
|
||||
{% unless show_sold_out_badge %}
|
||||
<span
|
||||
@@ -297,68 +354,11 @@
|
||||
{%- endif -%}
|
||||
</span>
|
||||
{% endunless %}
|
||||
{%- elsif card_product.compare_at_price > card_product.price
|
||||
{%- elsif card_product_compare_at_price > card_product_price
|
||||
and card_product.available
|
||||
and show_sale_badge == false
|
||||
-%}
|
||||
{% if settings.dbtfy_discount_saved and section.settings.custom_badge_label == blank %}
|
||||
{% liquid
|
||||
assign card_product_compare_at_price = card_product.compare_at_price
|
||||
assign card_product_price = card_product.price
|
||||
|
||||
comment
|
||||
start Yagi app code
|
||||
endcomment
|
||||
assign public_or_tags_matched = true
|
||||
|
||||
if product.metafields.app--168074346497.segment_tags.value.size > 0
|
||||
assign public_or_tags_matched = false
|
||||
endif
|
||||
|
||||
for etag in product.metafields.app--168074346497.segment_tags.value
|
||||
if customer.tags contains etag
|
||||
assign public_or_tags_matched = true
|
||||
break
|
||||
endif
|
||||
endfor
|
||||
|
||||
if public_or_tags_matched
|
||||
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_product.price
|
||||
endif
|
||||
endif
|
||||
|
||||
comment
|
||||
end Yagi app code
|
||||
endcomment
|
||||
%}
|
||||
{% render 'dbtfy-discount-saved',
|
||||
product_compare_price: card_product_compare_at_price,
|
||||
product_price: card_product_price
|
||||
@@ -878,7 +878,7 @@
|
||||
{%- endif -%}
|
||||
</span>
|
||||
{% endunless %}
|
||||
{%- elsif card_product.compare_at_price > card_product.price
|
||||
{%- elsif card_product_compare_at_price > card_product_price
|
||||
and card_product.available
|
||||
and show_sale_badge == false
|
||||
-%}
|
||||
|
||||
Reference in New Issue
Block a user