product card badge
This commit is contained in:
@@ -0,0 +1,23 @@
|
|||||||
|
{%- assign badge_position = settings.badge_position -%}
|
||||||
|
{% liquid
|
||||||
|
assign product_card_product_price = product_card_product.price
|
||||||
|
|
||||||
|
assign product_card_product_compare_at_price = product_card_product.compare_at_price
|
||||||
|
|
||||||
|
assign product_card_product_price = product_card_product.metafields.app--168074346497.min_auto_discounted_price.value | default: product_card_product.price
|
||||||
|
|
||||||
|
if product_card_product_price < product_card_product.price and product_card_product_compare_at_price == 0 or product_card_product_compare_at_price == blank
|
||||||
|
assign product_card_product_compare_at_price = product_card_product.price
|
||||||
|
endif
|
||||||
|
%}
|
||||||
|
{%- unless product_card_product.available -%}
|
||||||
|
<span class="badge out-of-stock {{ badge_position }}">{{ 'products.product.sold_out' | t }}</span>
|
||||||
|
{%- endunless -%}
|
||||||
|
{%- if product_card_product_compare_at_price > product_card_product_price and product_card_product.available -%}
|
||||||
|
<span class="badge onsale {{ badge_position }}">{{ 'products.product.on_sale' | t }}</span>
|
||||||
|
{%- endif -%}
|
||||||
|
{%- if product_card_product.metafields.theme.preorder and product_card_product.available -%}
|
||||||
|
<span class="badge pre-order {{ badge_position }}">
|
||||||
|
{{ 'products.product.pre_order' | t }}
|
||||||
|
</span>
|
||||||
|
{%- endif -%}
|
||||||
Reference in New Issue
Block a user