I'm using a script to show the price of the product as installments (very common here in Brazil) and it works fine for products that has no variants or has variants with the same price.
The problem is when the variant has a different price. The installments value does not update according to the new variant price. Please check image below for a better understanding.
On the left there is the first variant, the "small" version of the product. The installments are ok.
On the right we have the "medium" size variant with a different price. The installments are the same to the "small" version, which is wrong.
The script I'm using is this below. I thought that if I change the "product.price" to "variant.price" it would fix the problem, but then value on the installment goes to R$0.00.
Does anyone know how can I edit this script to show the installments according to the variant price?
Note: This script is being used on Sections, product-template.liquid
Thanks a lot!
Could you please share the URL so that we can look at it to find any obvious issue in the script?