Changing Webflow's E-commerce variant select style to radio buttons

Hi,
I managed to implement this on a client project,
I also came across the same problem when updating the select field,
Basically we need to trigger change event of the select field right after updating it, you need to do this with vanilla JS,
jQuery’s trigger(“change”) can’t do it.

selectElement.value = "new value" // update select field's value
setTimeout((el)=>{  // trigger change event of the select field.
  e=document.createEvent('HTMLEvents');
  e.initEvent('change',false,true);
  el.dispatchEvent(e)
},0, selectElement)
1 Like