Change sale badge to percent off (Origin)

Hi guys, I have been in a couple of threads now searching for the right code to change the sale badge to percent. I have tried a bounce of different codes but nothing works. Please help me!

Theme: Origin 2.0

Thanks.

Hi @Landeryd

Please share your Sale badge code.

Thanks

Hi, please see the code down below.

<span
id=“Badge-{{ section_id }}-{{ card_product.id }}”
class=“badge badge–bottom-left color-{{ settings.sale_badge_color_scheme }}”

{{- ‘products.product.on_sale’ | t -}}

Hi, please see the code down below.

<span
id=“Badge-{{ section_id }}-{{ card_product.id }}”
class=“badge badge–bottom-left color-{{ settings.sale_badge_color_scheme }}”

{{- ‘products.product.on_sale’ | t -}}

Hi @Landeryd

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

Just replace this line of code with the below code

{%- assign percent = card_product.compare_at_price | minus: card_product.price | times: 
   100 | divided_by: card_product.compare_at_price | round -%}
  {{ percent }}% off