Skip to content
This repository has been archived by the owner on Aug 14, 2023. It is now read-only.

Any documentation on how to tap into the Variants class imported into product.js? #127

Open
adrianocr opened this issue Dec 2, 2018 · 2 comments

Comments

@adrianocr
Copy link

I need to tap into the _onSelectChange method in the Variants class.

If I add my function call directly inside that method it works fine. But I would love to be able to call it directly from product.js but unfortunately I'm just not knowing how to go about it.

I've gotten as far as var variants = new Variants(options); but that options part is confusing. Something about a container and different selectors and product, etc. The lack of documentation makes it very hard to figure out.

Thanks

@adrianocr adrianocr changed the title Any documentation on how to tap into the variants class imported into product.js? Any documentation on how to tap into the Variants class imported into product.js? Dec 2, 2018
@t-kelly
Copy link
Contributor

t-kelly commented Dec 3, 2018

Moving this to Starter Theme as this is not related to this repo.

@t-kelly t-kelly transferred this issue from Shopify/slate Dec 3, 2018
@t-kelly t-kelly self-assigned this Dec 4, 2018
@huguestennier
Copy link
Contributor

huguestennier commented Dec 10, 2018

theme-variants will emit different event that you can listen too in your scripts. In your case, you can look at how we're listening to variantChange in Starter theme.

theme-variants definitely needs some love on the documentation side.
Related documentation issue : Shopify/theme-scripts#44.

Hope this helps!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants