{% comment %} @param product {Object} [Required] The product which we want to display the price for @param selected_variant {Variant} [Optional] Renders selected variant instead of overall product pricing @param class {String} [Optional] Adds any additional classes to the price element {% endcomment %} {%- liquid if selected_variant assign current_product = selected_variant else assign current_product = product endif assign compare_at_price = current_product.compare_at_price assign price = current_product.price | default: 1999 assign available = current_product.available | default: false if selected_variant assign price = current_product.metafields.app--168074346497.auto_discounted_price.value | default: current_product.price if current_product.metafields.app--168074346497.discount_type.value != nil and current_product.metafields.app--168074346497.discount_type.value != "fixed" and product.metafields.app--168074346497.discount_percentage.value > 0.01 assign deducted_percentage = 1.0 | minus: product.metafields.app--168074346497.discount_percentage.value if current_product.metafields.app--168074346497.discount_percentage.value > 0.01 assign deducted_percentage = 1.0 | minus: current_product.metafields.app--168074346497.discount_percentage.value endif assign price = current_product.price | divided_by: 100.0 | times: deducted_percentage | times: 100.0 | ceil assign compare_at_price = current_product.price if current_product.compare_at_price > compare_at_price assign compare_at_price = current_product.compare_at_price endif endif else assign 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 price = product.price | divided_by: 100.0 | times: deducted_percentage | times: 100.0 | ceil assign compare_at_price = product.price if product.compare_at_price > compare_at_price assign compare_at_price = product.compare_at_price endif endif endif if price < current_product.price and compare_at_price == blank assign compare_at_price = current_product.price endif assign money_price = price | money assign money_compare = compare_at_price | money if settings.currency_code_enabled assign money_price = price | money_with_currency assign money_compare = compare_at_price | money_with_currency endif assign savings_varies = false assign savings = blank assign money_savings = blank if compare_at_price > price if settings.price_savings_style == 'dollar' assign savings = compare_at_price | minus: price else assign savings = price | times: 100 | divided_by: compare_at_price assign savings = 100 | minus: savings endif endif if current_product == product if current_product.price_varies assign money_price = 'products.price.from_price' | t: price: money_price endif if settings.price_show_saved and current_product.variants.size > 1 for product_variant in current_product.variants assign product_variant_price = product_variant.price assign product_variant_compare_at_price = product_variant.compare_at_price assign product_variant_price = product_variant.metafields.app--168074346497.auto_discounted_price.value | default: product_variant.price if product_variant.metafields.app--168074346497.discount_type.value != nil and product_variant.metafields.app--168074346497.discount_type.value != "fixed" and current_product.metafields.app--168074346497.discount_percentage.value > 0.01 assign deducted_percentage = 1.0 | minus: product_variant.metafields.app--168074346497.discount_percentage.value if product_variant.metafields.app--168074346497.discount_percentage.value > 0.01 assign deducted_percentage = 1.0 | minus: product_variant.metafields.app--168074346497.discount_percentage.value endif assign product_variant_price = product_variant.price | divided_by: 100.0 | times: deducted_percentage | times: 100.0 | ceil assign product_variant_compare_at_price = product_variant.price if product_variant.compare_at_price > product_variant_compare_at_price assign product_variant_compare_at_price = product_variant.compare_at_price endif endif if product_variant_price < product_variant.price and product_variant_compare_at_price == blank assign product_variant_compare_at_price = product_variant.price endif if product_variant_compare_at_price > product_variant_price if settings.price_savings_style == 'dollar' assign variant_savings = product_variant_compare_at_price | minus: product_variant_price else assign variant_savings = product_variant_price | times: 100 | divided_by: product_variant_compare_at_price assign variant_savings = 100 | minus: variant_savings endif if variant_savings != savings assign savings_varies = true endif if variant_savings > savings assign savings = variant_savings endif elsif savings > 0 assign savings_varies = true endif endfor endif endif if savings != blank if settings.price_savings_style == 'dollar' assign money_savings = savings | money if settings.currency_code_enabled assign money_savings = savings | money_with_currency endif else assign money_savings = savings | append: '%' endif endif -%}