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.
Learn these 5 things I had to learn the hard way with starting and running my own business
By Kitana Jan 27, 2023Would you love to unleash the unbridled power of the Google Shopping Channel into your sho...
By Gabe Jan 6, 2023How can you turn a hobby into a career? That’s what Emmanuel did while working as a wa...
By Skye Dec 30, 2022