Headless commerce and custom storefronts with Shopify APIs and SDKs
Hi,
I'm trying to fetch information of a single product in Unity through Unity Buy SDK. Since I need info from the Media object, the ShopifyBuy.Client().products() is not enough and I'm using ShopifyBuy.Client().query(query, callback);
To specify the query, I've created the GraphQL root query to fetch the necessary fields for product with filter title "Test Sofa":
QueryRootQuery query = new QueryRootQuery();
query.products(p => p
.edges(pe => pe
.node(pn => pn
.description()
.handle()
.id()
.media(m => m
.edges(me => me
.node(mn => mn
.alt()
.onModel3d(ms => ms
.sources(src=> src
.format()
.url())))))
.onlineStoreUrl()
.title()))
,1,null,null,null,null,null,"title:Test Sofa",null);
(Refer attachment for snippet)
But when I pass this query, I'm getting an error from the API:
["You must provide one of first or last"]
I know this means we have to pass the 'first' or 'last' for the query to get amount of objects returned. But I'm not able to figure where to put this value in the method signature of query.products() . I passed 1 as the value for long first, but I'm still seeing the same message. I've been through the documentation and the code of QueryRootQuery.
Could anyone help me write the exact code to achieve this i.e. pass the first/last values that the API requires?
Thanks.
As a business owner, have you ever wondered when your customer's first impression of yo...
By Skye Jun 6, 2023We're excited to announce improvements to the threaded messaging experience in our communi...
By TyW May 31, 2023Thank you to everyone who participated in our AMA with Klaviyo. It was great to see so man...
By Jacqui May 30, 2023