Headless Shopify Product Metafield support?

I am adding some metafields to my shopify products. How do I set up my custom product component to fetch these metafields on the product? they are basically more robust description properties, but I would like to add more.

The component for reference:

Thanks in advance!

Hi @fakejohnpope , Metafields are only available on Shopify Admin’s API, so you’d want to request that when you’re fetching the product.

Alternatively you can use Builder’s Data model , then use the content API to query for the data model entry that extends your product.

Hey @aziz thanks so much for the reply! can you elaborate on the second option? I still don’t fully understand how the builder data models work. If i want to have custom fields available for each product, what is the process of updating the builder model to include those, and how to i set the values of each field for each product? would i have a different model for each product?

I recorded a loom on one way how to go about extending your product object with data models, it ended up longer than I expected (play it on 1.5x speed) Loom | Free Screen & Video Recording Software

This is so awesome! Thank you so much for putting this together, it really bridged the gap for me as to how to incorporate models into my project!

1 Like

@aziz I need to retrieve product variant meta fields using the builder API. you can storefront API to get meta fields Retrieve metafields with the Storefront API