gil-- / gatsby-starter-shopifypwa

💚:shopping_cart:💚 Bodega is a Shopify PWA using Gatsby JS + Netlify CMS
https://bodega.netlify.com
MIT License
103 stars 9 forks source link

Add variant selectors and update state #26

Closed gil-- closed 5 years ago

gil-- commented 5 years ago

Lots more work needs to be done here:

Most of this code was ripped from Shopify graphql example: https://github.com/Shopify/storefront-api-examples/tree/master/react-graphql-client

screen shot 2018-09-25 at 11 02 09 pm
gil-- commented 5 years ago

Merging since preview builds successfully. Still more work to be done per PR comment but like everything, WIP.

tijsluitse commented 5 years ago

Hi @gil-- , I'm trying to get this variant selector working with multiple product options. All options can be combined and have different prices and images. I'm struggling to set the state based on the first options and handling the option change with finding the right variant. Do you have a good suggestion? The first two are custom radio buttons and the third is a textual option select input.

options = [{ name: "Frame", values: ["Black", "White"] }, { name: "Saddle", values: ["Brown", "Black"] }, { name: "Accu", values: ["Standard", "Extended"] }]