Hi @gwacht ,
Welcome to the Shopify Community!
I understand that you want to show the percentage discounted under the price. You’ve added it to your product-template.liquid file but you also want the discount to show up elsewhere on the store, not just when you select the product.
For the Debut theme, the place to add your code is in the product-price.liquid file, located in the Snippets folder.
Before you customize your theme:
- Duplicate your theme to create a backup copy. This makes it easy to discard your changes and start again if you need to.
Add your code just above the **** tag, like this:
{% if variant.title %}
{%- assign compare_at_price = variant.compare_at_price -%}
{%- assign price = variant.price -%}
{%- assign available = variant.available -%}
{% else %}
{%- assign compare_at_price = 1999 -%}
{%- assign price = 1999 -%}
{%- assign available = true -%}
{% endif %}
{%- assign money_price = price | money -%}
<dl>
{% if section.settings.show_vendor %}
<dt>
{{ 'products.product.vendor' | t }}
</dt>
<dd>
{{ product.vendor }}
</dd>
{% endif %}
<dt>
{{ 'products.product.regular_price' | t }}
</dt>
<dd>
{% if available %}
{% if compare_at_price > price %}
<s>
{{ compare_at_price | money }}
</s>
{% else %}
{{ money_price }}
{% endif %}
{% else %}
{{ 'products.product.sold_out' | t }}
{% endif %}
</dd>
<dt>
{{ 'products.product.sale_price' | t }}
</dt>
<dd>
{{ money_price }}
{{ 'products.product.on_sale' | t }}
</dd>
<dt>
{{ 'products.product.unit_price_label' | t }}
</dt>
<dd>
{%- capture unit_price_separator -%}
/{{ 'general.accessibility.unit_price_separator' | t }}
{%- endcapture -%}
{%- capture unit_price_base_unit -%}
{%- if available and variant.unit_price_measurement -%}
{%- if variant.unit_price_measurement.reference_value != 1 -%}
{{- variant.unit_price_measurement.reference_value -}}
{%- endif -%}
{{ variant.unit_price_measurement.reference_unit }}
{%- endif -%}
{%- endcapture -%}
{{ variant.unit_price | money }}{{- unit_price_separator -}}{{- unit_price_base_unit -}}
</dd>
{% if product.compare_at_price_max > product.price %}Total Savings {{ product.compare_at_price_max | minus: product.price | times: 100.0 | divided_by: product.compare_at_price_max | money_without_currency | times: 100 | remove: '.0'}}%{% endif %}
</dl>
Let me know if this solves your problem or if you need further help!
[/quote][quote=“BrianAtWork”]
Hi @gwacht ,
Welcome to the Shopify Community!
I understand that you want to show the percentage discounted under the price. You’ve added it to your product-template.liquid file but you also want the discount to show up elsewhere on the store, not just when you select the product.
For the Debut theme, the place to add your code is in the product-price.liquid file, located in the Snippets folder.
Before you customize your theme:
- Duplicate your theme to create a backup copy. This makes it easy to discard your changes and start again if you need to.
Add your code just above the **** tag, like this:
{% if variant.title %}
{%- assign compare_at_price = variant.compare_at_price -%}
{%- assign price = variant.price -%}
{%- assign available = variant.available -%}
{% else %}
{%- assign compare_at_price = 1999 -%}
{%- assign price = 1999 -%}
{%- assign available = true -%}
{% endif %}
{%- assign money_price = price | money -%}
<dl>
{% if section.settings.show_vendor %}
<dt>
{{ 'products.product.vendor' | t }}
</dt>
<dd>
{{ product.vendor }}
</dd>
{% endif %}
<dt>
{{ 'products.product.regular_price' | t }}
</dt>
<dd>
{% if available %}
{% if compare_at_price > price %}
<s>
{{ compare_at_price | money }}
</s>
{% else %}
{{ money_price }}
{% endif %}
{% else %}
{{ 'products.product.sold_out' | t }}
{% endif %}
</dd>
<dt>
{{ 'products.product.sale_price' | t }}
</dt>
<dd>
{{ money_price }}
{{ 'products.product.on_sale' | t }}
</dd>
<dt>
{{ 'products.product.unit_price_label' | t }}
</dt>
<dd>
{%- capture unit_price_separator -%}
/{{ 'general.accessibility.unit_price_separator' | t }}
{%- endcapture -%}
{%- capture unit_price_base_unit -%}
{%- if available and variant.unit_price_measurement -%}
{%- if variant.unit_price_measurement.reference_value != 1 -%}
{{- variant.unit_price_measurement.reference_value -}}
{%- endif -%}
{{ variant.unit_price_measurement.reference_unit }}
{%- endif -%}
{%- endcapture -%}
{{ variant.unit_price | money }}{{- unit_price_separator -}}{{- unit_price_base_unit -}}
</dd>
{% if product.compare_at_price_max > product.price %}Total Savings {{ product.compare_at_price_max | minus: product.price | times: 100.0 | divided_by: product.compare_at_price_max | money_without_currency | times: 100 | remove: '.0'}}%{% endif %}
</dl>
Let me know if this solves your problem or if you need further help!
[/quote][quote=“BrianAtWork”]
Hi @gwacht ,
Welcome to the Shopify Community!
I understand that you want to show the percentage discounted under the price. You’ve added it to your product-template.liquid file but you also want the discount to show up elsewhere on the store, not just when you select the product.
For the Debut theme, the place to add your code is in the product-price.liquid file, located in the Snippets folder.
Before you customize your theme:
- Duplicate your theme to create a backup copy. This makes it easy to discard your changes and start again if you need to.
Add your code just above the **** tag, like this:
{% if variant.title %}
{%- assign compare_at_price = variant.compare_at_price -%}
{%- assign price = variant.price -%}
{%- assign available = variant.available -%}
{% else %}
{%- assign compare_at_price = 1999 -%}
{%- assign price = 1999 -%}
{%- assign available = true -%}
{% endif %}
{%- assign money_price = price | money -%}
<dl>
{% if section.settings.show_vendor %}
<dt>
{{ 'products.product.vendor' | t }}
</dt>
<dd>
{{ product.vendor }}
</dd>
{% endif %}
<dt>
{{ 'products.product.regular_price' | t }}
</dt>
<dd>
{% if available %}
{% if compare_at_price > price %}
<s>
{{ compare_at_price | money }}
</s>
{% else %}
{{ money_price }}
{% endif %}
{% else %}
{{ 'products.product.sold_out' | t }}
{% endif %}
</dd>
<dt>
{{ 'products.product.sale_price' | t }}
</dt>
<dd>
{{ money_price }}
{{ 'products.product.on_sale' | t }}
</dd>
<dt>
{{ 'products.product.unit_price_label' | t }}
</dt>
<dd>
{%- capture unit_price_separator -%}
/{{ 'general.accessibility.unit_price_separator' | t }}
{%- endcapture -%}
{%- capture unit_price_base_unit -%}
{%- if available and variant.unit_price_measurement -%}
{%- if variant.unit_price_measurement.reference_value != 1 -%}
{{- variant.unit_price_measurement.reference_value -}}
{%- endif -%}
{{ variant.unit_price_measurement.reference_unit }}
{%- endif -%}
{%- endcapture -%}
{{ variant.unit_price | money }}{{- unit_price_separator -}}{{- unit_price_base_unit -}}
</dd>
{% if product.compare_at_price_max > product.price %}Total Savings {{ product.compare_at_price_max | minus: product.price | times: 100.0 | divided_by: product.compare_at_price_max | money_without_currency | times: 100 | remove: '.0'}}%{% endif %}
</dl>
Let me know if this solves your problem or if you need further help!