How do you go about creating users account in React Gatsby?

Solved
Highlighted
Shopify Partner
22 0 2

Hi,

 

I am using Shopify SDK API to build the checkout process on my eCommerce website but now I want to make user accounts. Is there another API to do this or how would I go about creating users and saving their data to their accounts and displaying the type of products they have purchased?

 

 

 

0 Likes
Highlighted
Tourist
6 1 0

Hello

 

Check the Storefront API. It allows you to create customers via their customerCreate GraphQL mutation pretty easily :)

Here is a link to the reference: https://help.shopify.com/en/api/storefront-api/reference/mutation/customercreate

0 Likes
Highlighted
Shopify Partner
22 0 2

Thank you! I will go ahead an check it out!

0 Likes
Highlighted
Shopify Partner
22 0 2

hey @Sound_Vault ,

 

Would you say it would be better if I was to approach this task by building a graphQL Prisma API that I can then pass the inputs tp from my frontend to be more secure and save additional data that Shopify doesn't provide or do everything directly from gatsby frontend? 

 

Currently, I do most of the logic on a context file using react hooks... but I see it overcrowding the file once I start to implement the login for users and other users perks.

0 Likes
Highlighted
Tourist
6 1 0

This is an accepted solution.

Hey MadGenius,

I personally would have all inputs on my own frontend, and send the data from them to the Storefront API via a mutation. You get the newly created id back as well!

Regarding the client I would use, you should check Apollo, they are amazing for GraphQL.
0 Likes
Highlighted
Shopify Partner
22 0 2

Hey @Sound_Vault ,

 

Got it! thank you for answering my question! so pretty much rely on Shopify for backend correct? I will explore more in-depth the created ID  you get back to see how I can improve the interface and make it as flexible as possible.

0 Likes