Files
Ella/snippets/product-card.liquid

7 lines
999 B
Plaintext

{% assign yagi_discount_percentage = '"discount_percentage": 0' %}
{% if product.metafields.app--168074346497.discount_percentage.value > 0.01 %}
{% capture yagi_discount_percentage %}"discount_percentage": {{ product.metafields.app--168074346497.discount_percentage.value }}{% endcapture %}
{% endif %}
// ... find the line below, then paste above, and add yagi_discount_percentage into data-json-product below
<div class="product-item{% if settings.enable_background_button_card %} enable_background_button_card{% endif %}{% if settings.enable_custom_layout_card_1 %} enable_custom_layout_card_1{% endif %}{% if settings.enable_custom_position_swatch_layout_card_1 %} enable_custom_position_swatch{% endif %}" data-product-id="{{ product_card_product.id }}" data-json-product='{ {{ yagi_discount_percentage }},"id": {{product_card_product.id}},"handle": "{{product_card_product.handle}}","media": {{product.media | json | escape}},"variants": {{ product_card_product.variants | json | escape}}}'>