Hi Javier, thanks for the code!
I tried adding it do the custom.js folder, to no avail. The buttons are displayed correctly, but the Add to cart button doesn't work.
Should I paste in theme.js or another js folder?
I use Narrative theme, and here is the example page.
Shoutout to anyone else: have you found a way to make it work in the Narrative theme?