Script that refreshes the page with variant change is also updating when I change the quantity

I’ve used the script bellow to update my metafield data in a variant change event.

But it also refresh when I change product’s quantity, returning always quantity = 1.


Can someone help me? Thanks

Hi @guilhermealbino ,

I really don’t understand your question, but the code you sent is not really good.

I checked and it won’t help you to update anything. It will reload the page when you click on any class ‘no-js-hidden’ so there won’t be metafield data.

If you want to catch a block, you need to create a separate class for it.

Hope it helps!

What I’m trying to do is something that updates the div where the metafields are shown when I change a product’s variant. What you said already made me understand why it updates when I change the product’s quantity. The quantity field is also of the “no-js-hidden” class.

@LitExtension Would you have any way to resolve this issue? I noticed that some fields use the “radio” type;

Thanks

Hi @guilhermealbino ,

Please send your site and if your site is password protected, please send me the password. I will check it.

Dealing with similar issue. What was your fix?