Add functions
Update widget attributes
info
Almost every shop uses product variants. If your shop uses product variants on the product page (e.g. different colors, different frame shapes etc.) make sure to udpate the button configuration to request always the correct product code.
You can do so by updating the widget attributes with simple javascript. Make sure to trigger the function on variant change.
const widget = document.querySelector('#onlinesizing-widget');
widget?.setAttribute('variant-id', newVariantId);
widget?.setAttribute('global-id', newGlobalId);
widget?.setAttribute('image', newImage);