'Update tax on changing variant in shopify DAWN theme

I would like to know how I can achieve to update the tax price given in the following image. enter image description here

I inserted the following code into my price:

            {%- if shop.taxes_included or shop.shipping_policy.body != blank -%}
              <div class="product__tax caption rte">
                {%- if shop.taxes_included -%} 
                  {{ 'products.product.include_taxes' | t }}
                  <span id="taxPrice" class="product__tax caption rte" itemprop="price">                
                    {{ product.price | times:0.19 | money }}
                    <br>zzgl. Versand
                  </span> 
                {%- endif -%} 

Now I want to achieve that the price for the taxes update as I change the variant. I'm pretty sure it's possible with some JS, but unfortunately I have no experience in JS.

I'll appreciate every possible answer.

I tried to insert a JS code snippet (into the global.js file) from an older shopify support ticket regarding the same thing.

$('#taxPrice').html( Shopify.formatMoney(variant.price * 0.19, moneyFormat) );

But didn't work out as expected, although it worked on the Minimal theme just fine.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source