How to Show Discount for Automatic Discount. [Dawn Theme v10]

Topic summary

A user shares a workaround for displaying automatic discounts on product pages in Shopify’s Dawn theme v10. The solution involves:

Implementation steps:

  • Create a custom metafield called “Sale.Discount” (Integer type) under Products in store settings, exposed to Storefront
  • Modify the Price.liquid file by adding code that checks for a “Sale” tag on products
  • The code calculates discounted prices using the metafield percentage value
  • Optionally modify sale badge markup to display discount details

Key limitations:

  • Only controls display on product and collection pages via Price.liquid
  • Not suitable for “Buy 1 Get 1% OFF” type promotions
  • Requires manual setup: adding “Sale” tag to products and entering discount percentage in the metafield

Current status:
One user reports the code isn’t working despite adding the “Sale” tag. The original poster clarifies that both the tag AND the metafield with discount numbers are required for the solution to function. Another user requests more detailed instructions on creating and configuring the metafield in the admin panel.

Summarized with AI on November 14. AI used: claude-sonnet-4-5-20250929.

Currently works for Dawn v10

I know few peopled have been looking for this solution for awhile. I know I have. Even though, this won’t automatically terminate the sale but it is a solution that works.

First step is to create Metafield Integer called Sale.Discount under Products. Make sure it’s exposed to Storefront.

Then Look for this bit of code in Price.Liquid

{%- comment -%} No Compare Price
Explanation of description list:
- div.price__regular: Displayed when there are no variants on sale
- div.price__sale: Displayed when a variant is a sale
{%- endcomment -%}

And Copy this code below

{%- comment -%} No Compare Price  {%- endcomment -%}
    
      {{ 'products.product.price.regular_price' | t }}
      
        {{ money_price }}
      
    

    {%- comment -%} With  Compare Price  {%- endcomment -%}
    
    
      {%- unless product.price_varies == false and product.compare_at_price_varies %}
{%- comment -%} This IF/ELSEIF checks if product has 'Sale' TAG. If it does, it generates promo price.  {%- endcomment -%}
      {% if product.tags contains 'Sale' %}

          
        {%- comment -%} This code will use metafield discount amount to calculate the new price.  {%- endcomment -%}
            {% assign discount = product.metafields.sale.discount | times: product.price | divided_by: 100 %} {% assign discountedPrice = product.price | minus: discount %} 
            Sale Price: {{ discountedPrice | money }}

           
      
{% else %}{%- comment -%}  This is the Original code for Compare Price  {%- endcomment -%}
        {{ 'products.product.price.regular_price' | t }}
        
          <s>
            {% if settings.currency_code_enabled %}
              {{ compare_at_price | money_with_currency }}
            {% else %}
              {{ compare_at_price | money }}
            {% endif %}
          </s>
        
      {% endif %}
      {%- endunless -%}

      
      {{ 'products.product.price.sale_price' | t }}
      
        {%- comment -%} This bit of code check if item is on sale,  if not, it will strike it out. Similar to how original code did to Compare price  {%- endcomment -%}
        {% if product.tags contains 'Sale' %}
             ~~Price:{{ money_price }}~~ 
        {% else %}
            {{ money_price }}
        {% endif %}

      
    

to just above this line

<small>

Then change sale badge code

{%- if show_badges -%}

to

{%- if product.tags contains 'Sale' and show_badges -%}

This won’t be suitable for people with Buy 1, get 1 % OFF. Price.Liquid controls collection pages and Product pages. But you can still use it you add Promotion details. Just add separate metafield to Main-Product to something like

{{ product.metafields.sale.details }}

If anyone wants to tip me for this, just message me.

I’ve tried your code but seem like it’s not working. I put “Sale” tag on product as well as start discount campaign. Nothing change on my collection. Could you help please?

You need the metafield as well.

product.metafields.sale.discount

Call it product.discount and only numbers. That’s where magic actually happens.

Thanks for the great information. I’m doing it the way you suggested, but I’m not sure how to modify the metafields on the product page.

"Just add separate metafield to Main-Product to something like "

Can you explain it in detail for a beginner?

You need to create metafield in store settings>Custom Data. Choose the Product category. Name it ‘sale. Discount’. Then in the product pages in admin, add percentage number (without % sign).