Widget
To add the widget, you will need to edit the product page. As explained in the Widget section, you should integrate the loading of a script and the instantiation of the custom element.
We recommend using Shopify sections and/or snippets to keep your code modular. For more information, refer to the official documentation on theme architecture.
Here is an example of Liquid code that defines the necessary variables for the widget using Shopify’s contextual information, and then instantiates the custom HTML element: