Alot of themes emit their own change event hunt for that and use it.
Try the code without the DOMContentLoaded in browser devtools console panel.
Ensure the element actually exists some themes do wonky things.
Ensure your selectors are targeting the correct element, either specific tag or that there are not multiples and your getting the wrong one. etc etc etc
Sight unseen the code seems fine but who knows what else is going on in your theme because you did not provide any inspectable urls so it will always be completed guessworkd for other people.
@btromero
When going to the product page, It calculates the discounts as per the lowest price first, so if the largest priced variation is selected by default it will show the discounted price of the lowest variation. When we select the other variations then it shows the proper prices. Can we fix it?
Also can we show the store currency here instead of Rs. : Rs.{{
product.price | divided_by: 100 | times: 0.80 | round }}
@btromero Thank you. Actually I am not a programmar and couldn’t understand what to do. I tried somethings from above solution. Also tried Chatgpt to solve it according to your solution, but nothing is working. Can you provide the script with the changes? It’ll be helpful.
Thanks