Dedicated to the Hydrogen framework, headless commerce, and building custom storefronts using the Storefront API.
metaobject(handle: { handle: "dacia", type: "car-manufacturer" }) { fields { references(first: 250) { nodes { __typename ... on Metaobject { fields { value } } } } } }
https://shopify.dev/docs/api/storefront/2023-01/objects/Metaobject
Inside the documentation of the Metaobject it reads that you cannot load references of MetaObjects.
In the Shopify Admin area however you can see up to ten references for each metaobject. Why isn't this part of the API? Are there workarounds?
Right now the only possible option seems to be to fetch all metaobjects and save them for a limited time on my PHP server to a MySQL database (where I can filter the data properly) and send only the required data as a reply to AJAX requests. But this is actually truly elaborate, I kinda expect the Shopify APIs to be able to deliver those data out of the box. What's your thoughts on this?
Hey @carhifi
We were chatting here about this and based on the documentation, it seems that you are correct that the Shopify GraphQL API does not currently support loading references of metaobjects.
One potential workaround could be to use a different API that provides more advanced querying capabilities, such as the Shopify Admin API. However, this would require additional setup and configuration on your part. Again I'm no expert but hope you will find a solution for your car parts shop if the previously linked apps cannot help you!
Best,
Gabe | Social Care @ Shopify
- War meine Antwort hilfreich? Klicke Like um es mich wissen zu lassen!
- Wurde deine Frage beantwortet? Markiere es als Akzeptierte Lösung
- Um mehr zu erfahren, besuche das Shopify Help Center oder den Shopify Blog