Conversations about creating, managing, and using metafields to store and retrieve custom data for apps and themes.
Hi,
I was wondering if somebody could help explain how or if I can use the Storefront and Admin API's in the same product.
I am working on Custom Storefront for a client who has an existing Shopify store. For added context their current store was built by another development agency.
The store sells tailored clothing and allows customers to enter their measurements on their customer profile page. The current store is saving this data in Customer Metafields.
The plan for the new store is to build it with Nuxt, and combine the Storefront API with a Headless CMS for pages, blogs, etc.
The latest release of the StorefrontAPI allows the reading of metafields, but not writing them. Writing metafields requires the use of the AdminAPI and I also have to give permission to expose metafields to the StorefrontAPI using the AdminAPI. This is where my confusion comes in
I have used the Storefront API in a few other projects, mostly through the BuySDK. However, I have never used the Admin API and I am bit confused by how and where to use it and how to integrate it into my project.
Can I combine both the Storefront API and the Admin API in a frontend project?
I see that the Admin API requires authentication, unlike the Storefront API. Does that authentication need to be hidden behind my own backend service? Do I need proxy service that sits between my frontend and the store for saving metafields using the Admin API what hides the API authentication details?
Where would I "create a MetafieldStorefrontVisiblity record for each metafield" I want to expose? Do i need to do this when I am saving each field or this an initialization step I only need to do once for all customers?
Thank you for any clarification you can give.