How to dynamically update product variant prices including VAT on the product page?

Topic summary

Goal: Dynamically display product price including 21% VAT (Value Added Tax) on the product page, updating when variants change.

Implementation: A new template and section were created (Product.test.liquid, Product-template-test.liquid). A line was added calculating price_with_tax = current_variant.price × 1.21, rendered in an element with id ProductPriceVAT-{{ section.id }}. Testing is on a provided product URL.

Issue: The VAT-inclusive price does not update on variant change; it only updates after a full page refresh. An existing app currently shows prices excluding VAT but is planned for removal.

Findings: On each variant change, a JavaScript error occurs: “ruleTax is not defined.” A screenshot indicates this console error, suggesting a missing variable in the app’s or theme’s script, which likely interrupts the variant change handler and prevents updating the VAT line.

Status/Next steps: Unresolved. Define ruleTax or remove/fix the offending script, then ensure a variant-change listener updates the VAT price element in real time.

Summarized with AI on January 8. AI used: gpt-5.

From the way I see (Cause I don’t have access to your project), each time I triggered a change in the variant, it throws an error where ruleTax is not defined, which is true because within that function ruleTax is nowhere to be found.