show discount amount on product page

show discount amount on product page

nomihome
Visitor
3 0 0

I have the IMPACT theme

 

I have added a % discount site-wide to all products
I want this discount % amount to also show on each product page (and on the collection page) as well as a 'was £x now £x' strike through - similar to how adding a price markdown does this, but without actually adding the markdown.

The reason I dont want to add a markdown and a discount together, is that the discount becomes applied to the newly marked down price, not the original price.

I want the discount to show relative to the original price

Has anyone found a way to do this in this theme?

Thanks!

Replies 6 (6)

topnewyork
Astronaut
1047 142 181

Hello,

 

Please share "Store URL" and if you have any reference image so share that too.

 

Thanks!

Need a Shopify developer? Hire us at Top New York Web Design
Boost Your Store Sales with Volume/Tier Discount Try Big Bulk Discount
Create New Shopify Store For Just 1$/Month
nomihome
Visitor
3 0 0

site is https://nomi-home.com/

have added the 'compare at' markdown to one product as a reference for what I would like the discount to show up like (as well as applying the discount to the basket total)

minor thing but the 'save £X' red tag could also be replaced by 'save 30%' instead. not as urgent though

thanks in advance for any insight

 

Screenshot 2024-12-02 at 10.24.50.pngScreenshot 2024-12-02 at 10.25.00.png

topnewyork
Astronaut
1047 142 181

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 </dl> tag, like this:

<!-- snippet/product-price.liquid -->
{% 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 class="price{% if available and compare_at_price > price %} price--on-sale{% endif %}{% if available and variant.unit_price_measurement %} price--unit-available{% endif %}" data-price>

  {% if section.settings.show_vendor %}
    <div class="price__vendor">
      <dt>
        <span class="visually-hidden">{{ 'products.product.vendor' | t }}</span>
      </dt>
      <dd>
        {{ product.vendor }}
      </dd>
    </div>
  {% endif %}

  <div class="price__regular">
    <dt>
      <span class="visually-hidden visually-hidden--inline">{{ 'products.product.regular_price' | t }}</span>
    </dt>
    <dd>
      {% if available %}
        {% if compare_at_price > price %}
          <s class="price-item price-item--regular" data-regular-price>
            {{ compare_at_price | money }}
          </s>
        {% else %}
          <span class="price-item price-item--regular" data-regular-price>
            {{ money_price }}
          </span>
        {% endif %}
      {% else %}
        <span class="price-item price-item--regular" data-regular-price>
          {{ 'products.product.sold_out' | t }}
        </span>
      {% endif %}
    </dd>
  </div>
  <div class="price__sale">
    <dt>
      <span class="visually-hidden visually-hidden--inline">{{ 'products.product.sale_price' | t }}</span>
    </dt>
    <dd>
      <span class="price-item price-item--sale" data-sale-price>
        {{ money_price }}
      </span>
      <span class="price-item__label" aria-hidden="true">{{ 'products.product.on_sale' | t }}</span>
    </dd>
  </div>
  <div class="price__unit">
    <dt>
      <span class="visually-hidden visually-hidden--inline">{{ 'products.product.unit_price_label' | t }}</span>
    </dt>
    <dd class="price-unit-price">
      {%- capture unit_price_separator -%}
        <span aria-hidden="true">/</span><span class="visually-hidden">{{ 'general.accessibility.unit_price_separator' | t }}&nbsp;</span>
      {%- endcapture -%}
      {%- capture unit_price_base_unit -%}
        <span data-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 -%}
        </span>
      {%- endcapture -%}

      <span data-unit-price>{{ variant.unit_price | money }}</span>{{- unit_price_separator -}}{{- unit_price_base_unit -}}
    </dd>
  </div>
  {% 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>

Thanks!

Need a Shopify developer? Hire us at Top New York Web Design
Boost Your Store Sales with Volume/Tier Discount Try Big Bulk Discount
Create New Shopify Store For Just 1$/Month
nomihome
Visitor
3 0 0

Does this  also work the same way on the IMPACT theme?

Thanks

topnewyork
Astronaut
1047 142 181

Hope so, Try it and see.

Need a Shopify developer? Hire us at Top New York Web Design
Boost Your Store Sales with Volume/Tier Discount Try Big Bulk Discount
Create New Shopify Store For Just 1$/Month

Amanda_Fordeer
Shopify Partner
172 10 33

Hi @nomihome.

With Product Labels and Badges, you can easily create two campaigns (one for labels and one for price badges) that meet your needs by using:

 

1. Variable named {Discount_percentage} or {Discount_amount} (click on the three dots in the content section)

Amanda_Fordeer_1-1733391965821.png

 

2. Discount range feature in the Product settings tab

Amanda_Fordeer_0-1733391780371.png

If you find my suggestion helpful, please give it a like or mark it as a solution!
And discover more approaches to:
Streamline invoicing process Boost sales with labels & badges Add social proofs & create FOMO
Or get valuable updates and private deals regarding Shopify here.