Change Sale Badge to % off

Change Sale Badge to % off

In card-product.liquid
Idea
{% comment %}    {{- 'products.product.on_sale' | t -}}  {% endcomment %}
Idea
{%- assign percent = card_product.compare_at_price | minus: card_product.price | times: 100 | divided_by: card_product.compare_at_price | round -%}
Save {{ percent }}%
              </span>

In price.liquid

Change to:
Idea
{%- if show_badges -%}
    <span class="badge price__badge-sale color-{{ settings.sale_badge_color_scheme }}">
     {% comment %}      {{ 'products.product.on_sale' | t }} {% endcomment %}
  {%- assign percent = product.compare_at_price | minus:product.price | times: 100 | divided_by:product.compare_at_price | round -%}
Save {{ percent }}%
    </span>