Changing the sale badge on the product page > Landing page was able to change

Hello, I am trying to change the sale badge on the product page from the word Sale to the actual percentage example (35%). I was able to change in the landing page, all products under sales are showing the actual percentage but for days I couldn’t find where is the code line for the product page that need to be replaced.
I am using this code:

{%- if card_product.available == false -%} {{ 'products.product.sold_out' | t }} {%- elsif card_product.compare_at_price > card_product.price and card_product.available -%} {%- assign percent = card_product.compare_at_price | minus: card_product.price | times: 100 | divided_by: card_product.compare_at_price | round -%} -{{ percent }}% {%- endif -%}

Anyone knows?
Thanks

Which theme are you using and can you share the store link?

Hi,

I am using theme sense. Link: https://www.werkit.eu/

Thanks!

in the section/main-product you can attach your code inside div with class (product__info-wrapper) anywhere as you see fit but you have replace your card_product to product

You can find the code on price.liquid file around line 85.

If you need help with theme code edit, feel free to use our app to create the task. The first task is free.