Dedicated to the Hydrogen framework, headless commerce, and building custom storefronts using the Storefront API.
The following is a query I am using with checkout functions. The basic meta fields work, but when it comes to querying Metaobjects using references it does not work. The same query structure does work on the admin API.
I am beginning to wonder if functions only work for a subset of queries.
query Input { cart { lines { quantity discount: attribute(key: "dis"){ key value } merchandise { __typename ...on ProductVariant { id product { binding: metafield(namespace: "test_data", key: "binding_mount") { value } length: metafield(namespace: "test_data", key: "snowboard_length") { value } quantity_price_breaks: metafield(namespace: "custom", key: "quantity_price_breaks"){ value references(first: 3){ edges{ node{ ...on Metaobject{ fields{ key value } } } } } } } } } } } }
Having looked into this some more, I found that the schema.graphql file does not have the definition for Metaobject. From the reading I have done, the schema.graphql acts as a contract with the server and will not allow any definitions in the query that are not in the schema. The question I have then is, "Is the schema limited by design, or can it be replaced to allow more open-ended queries"? Is there a reason for not allowing Metaobjects in checkout functions?
Hi, have you found a way to use metaobjects in Shopify functions, or are you using some kind of workaround? In my case, I'll have to duplicate the information from a single metaobject into metafields for multiple products. I don't like this approach due to the limitations on the size of data that can be passed to the function.
Have not found a solution at this point, will let you know if one comes up. At this point have only been able to pass meta-fields, not meta-objects.