Product label sale on single product page

Topic summary

Adding a sale label to the single product page in a Shopify Venue theme is the main issue. The store owner inserted Liquid code into product.template.liquid, below the price heading and inside the product price container, to show either sale text or a discount percentage.

Current state:

  • It works correctly when a product has a discount.
  • It throws an error on products without a discount.
  • Screenshot links are important because they show the working discounted product and the error state on non-discounted products.

Relevant technical context:

  • product.template.liquid is the Shopify template for the product page.
  • The code uses product.compare_at_price and product.price to calculate the discount percentage.
  • A separate product-price Liquid file also exists, which may affect how pricing logic should be handled.

No fix was provided yet. The only reply asks for the store URL and password, so the discussion remains open and unresolved.

Summarized with AI on March 8. AI used: gpt-5.4.

I wanted to add product label sale on the single product page, and I managed to do this on with the following code in product.template.liquid

{% if settings.product_grid_label_sale_style == 'text' %}

{{ 'products.product.on_sale' | t }}

{% else %}

{{ product.compare_at_price | minus: product.price | times: 100.0 | divided_by: product.compare_at_price | round }}%

{% endif %}

I wrote code below

and inside

Everything works fine when product have discount as you can see here https://prnt.sc/11c575x

But when I have product page without discount I get this error https://prnt.sc/11c59bm

I do have product-price liquid file too. My theme is Venue.

1 Like

@Blok64IT Please provide the URL of your store and if it is password protected please share the password too. Thanks