thetrevorharmon / gatsby-theme-shopify-manager

The easiest way to start a Shopify shop on Gatsby.
https://gatsby-theme-shopify-manager.netlify.app/
MIT License
121 stars 11 forks source link

How do you add custom text fields to your products? #71

Open daydream05 opened 4 years ago

daydream05 commented 4 years ago

Hi, so I've never used shopify before so I don't really know where to start.

Basically, I want to have a product and a user can input a custom text field attached to that product.

How does one go about implementing that?

I see we have access to the client sdk but I'm not sure if I can update the metafields with that since it uses the storefront api

Thanks!

beamercola commented 4 years ago

Products in Shopify have a customAttributes array. I use this extensively:

addItemToCart(id, 1, [{ key: 'color', value: color }])

Let me know if you need any more help