How can I maintain consistent filters in my code?

Hello, is there any way to keep filters consistent?

This is the snippet of code I have right now:


        

          
            
              {{- current_variant.price | money_with_currency -}}
            
                            
        {%- if current_variant.compare_at_price > current_variant.price -%}                    
           
            
              {%- if current_variant.compare_at_price > current_variant.price -%}
              {{- current_variant.compare_at_price | money_with_currency -}}

          {%- if settings.product_sale_badge != '' and current_variant.compare_at_price > current_variant.price -%}
          

          {%- if settings.product_sale_badge == '0' -%}
          {{- 'products.product.sale' | t -}}
          {%- else -%}
          -{{current_variant.compare_at_price | minus:current_variant.price | times:100.0 | 
          divided_by:current_variant.compare_at_price | ceil }}%
          {%- endif -%}
          

          {%- endif -%}

              {%- endif -%}
            
          
          {%- endif -%}
        

      

The problem I’m having is, every time I select a variant, the snippet changes to the default which is:


        

          
            
              {{- current_variant.price | money -}}
            
          
        {%- if current_variant.compare_at_price > current_variant.price -%}                    
           
            
              {%- if current_variant.compare_at_price > current_variant.price -%}
              {{- current_variant.compare_at_price | money -}}
              {%- endif -%}
            
          
          {%- endif -%}
        

      

It removes the sales percentage box and removes the currency ISO code, any solutions?