Retrieving product data from custom field

Cheng-En
New Member
2 0 1

Hello community,

I'm new to Shopify API as well as coding, hopefully this is not so stupid question.

 

What I'm trying to achieve:

Retrieving data from a custom field of product and display it on our headless shopify store

 

My approach:

1. Find an App that allows me to add a custom field (probabaly a JSON) to the product.

2. Retrieving the data from custom field using Storefront API, looping through the object, and then display it however I want.

 

My questions:

1. Does the approach make sense to experienced Shopify developers?

2. Is there a recommended App for custom field?

 

Many thanks!

Cheng-En

0 Likes
c10s
Shopify Partner
15 2 3
  1. Yes, this approach makes sense.
  2. I've used Metafields Manager  in the past and it's worked well enough.

You'll also need to make sure you expose metafields to the Storefront API: https://shopify.dev/tutorials/retrieve-metafields-with-storefront-api#expose-metafields-to-the-store...

Not necessary but if you plan to store a lot of extra content in metafields it may make sense to use a separate CMS to manage the extra content then join the data together on the front-end (especially if content editors are less experienced, as updating metafields, especially in JSON isn't very user friendly).

Cheng-En
New Member
2 0 1

Thanks a lot for the information!

Yes we need to edit a lot extra data. We will probably host the static site on Gatsby so I will check some CMS that works well with it.

c10s
Shopify Partner
15 2 3

No problem and good luck!

If you don't want to host anything yourself I've found Sanity to be a great headless CMS.