{% comment %} Renders a list of product's price (regular, sale) Accepts: - product_ref: {Object} Product Liquid object - use_variant: {Boolean} Renders selected or first variant price instead of overall product pricing (optional) - price_class: {String} Adds a price class to the price element (optional) - price_extra_info: {Boolean} Show extra info about price (optional) Usage: {% render 'price', product_ref: product %} {% endcomment %} {%- liquid if use_variant assign target = product_ref.selected_or_first_available_variant else assign target = product_ref endif assign variant = product_ref.selected_or_first_available_variant assign compare_at_price = target.compare_at_price assign price = target.price | default: 1999 if target == product_ref and product_ref.price_varies == false assign compare_at_price = target.compare_at_price_max endif if use_variant assign price = target.metafields.app--168074346497.auto_discounted_price.value | default: target.price if target.metafields.app--168074346497.discount_type.value != nil and target.metafields.app--168074346497.discount_type.value != "fixed" and product_ref.metafields.app--168074346497.discount_percentage.value > 0.01 assign deducted_percentage = 1.0 | minus: product_ref.metafields.app--168074346497.discount_percentage.value if target.metafields.app--168074346497.discount_percentage.value > 0.01 assign deducted_percentage = 1.0 | minus: target.metafields.app--168074346497.discount_percentage.value endif assign price = target.price | divided_by: 100.0 | times: deducted_percentage | times: 100.0 | ceil assign compare_at_price = target.price if target.compare_at_price > compare_at_price assign compare_at_price = target.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 price = target.price | divided_by: 100.0 | times: deducted_percentage | times: 100.0 | ceil assign compare_at_price = target.price if target.compare_at_price > compare_at_price assign compare_at_price = target.compare_at_price endif endif if price < target.price and compare_at_price == blank assign compare_at_price = target.price endif else assign price = product_ref.metafields.app--168074346497.min_auto_discounted_price.value | default: product_ref.price if product_ref.metafields.app--168074346497.discount_percentage.value > 0.01 assign deducted_percentage = 1.0 | minus: product_ref.metafields.app--168074346497.discount_percentage.value assign price = product_ref.price | divided_by: 100.0 | times: deducted_percentage | times: 100.0 | ceil assign compare_at_price = product_ref.price if product_ref.compare_at_price > compare_at_price assign compare_at_price = product_ref.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 price = product_ref.price | divided_by: 100.0 | times: deducted_percentage | times: 100.0 | ceil assign compare_at_price = product_ref.price if product_ref.compare_at_price > compare_at_price assign compare_at_price = product_ref.compare_at_price endif endif if price < product_ref.price and compare_at_price == blank assign compare_at_price = product_ref.price endif endif assign available = target.available | default: false assign money_price = price | money assign price_extra_info = price_extra_info | default: false if settings.show_currency_codes assign money_price = price | money_with_currency endif -%}