Shopify/slate

Using onFormOptionChange() in templates/product.js

josefarrugia opened this issue · 1 comments

Hi there,

How do I go about using the onFormOptionChange() method found in sections/product.js inside templates/product.js or another file (example: components/collapse.js)?

Essentially, I want to manually trigger a renderPrice(), renderImages(), renderComparePrice, renderSubmitButton and so on when event happens – clicking on a button.

I made this helper function to get the product data for a product by inputting the variantId:

getVariantObject(variantId) {
    // eslint-disable-next-line eqeqeq
    return this.product.variants.find(({ id }) => id == variantId);
  }

I add this data as the event parameter and it seems to work.