{% comment %} It's best to load images as JPG instead of PNG for faster loading, so that is our default. If you upload PNG files and want to keep them that way, set the line below to false. {% endcomment %} {%- liquid unless grid_item_width assign grid_item_width = 'medium-up--one-quarter small--one-half' endunless -%} {% liquid # start Yagi app code assign active_discount = true assign empty_array = "" | split: "" assign dormant_discounts = shop.metafields.app--168074346497.dormant_discounts.value | default: empty_array assign target_discount_id = product.metafields.app--168074346497.applied_discount_id.value for dormant_discount in dormant_discounts if dormant_discount == target_discount_id assign active_discount = false endif endfor assign product_price = product.price assign product_compare_at_price = product.compare_at_price if active_discount assign product_price = product.metafields.app--168074346497.min_auto_discounted_price.value | default: product.price if product.metafields.app--168074346497.discount_percentage.value > 0.01 assign deducted_percentage = 1.0 | minus: product.metafields.app--168074346497.discount_percentage.value assign product_price = product.price | divided_by: 100.0 | times: deducted_percentage | times: 100.0 | ceil assign product_compare_at_price = product.price if product.compare_at_price > product_compare_at_price assign product_compare_at_price = product.compare_at_price endif endif if product_price < product.price and product_compare_at_price == blank assign product_compare_at_price = product.price endif endif # end Yagi app code %} {% comment %} Do not output the quick shop modal if we're loading related products through another quick shop modal. Determined by checking the product.ajax template suffix. These are loaded for product.sections templates but quickly removed in JS before appending the related section. {% endcomment %} {%- liquid assign enable_quick_shop = settings.quick_shop_enable if no_modal assign enable_quick_shop = false endif if template == 'product.ajax' assign enable_quick_shop = false endif assign on_sale = false if product_compare_at_price > product_price assign on_sale = true endif assign sold_out = true if product.available assign sold_out = false endif assign product_tags = product.tags | join: ',' assign has_custom_label = false if product.metafields.theme.label and product.metafields.theme.label != blank assign has_custom_label = true assign custom_label = product.metafields.theme.label.value elsif product_tags contains '_label_' for tag in product.tags if tag contains '_label_' assign tag_starts_with = tag | slice: 0 if tag_starts_with == '_' assign has_custom_label = true assign custom_label = tag | replace: '_label_', '' endif endif endfor endif -%}