Hello,
I am updating our functionality for importing products from Shopify. Previously we were importing the list by calling the RESP API endpoint:
admin/api/{SHOPIFY_API_VERSION}/products.json?fields=variants&limit={PRODUCTS_COUNT_LIMIT}
(with subsequent calls with paging), we then mapped the results to our data structures and merged them into our database. However at the time we only had one partner using Shopify, and so we just used one default category for all their products.
We are expecting a lot of new partners using Shopify, and we want to import the products with their respective categories. According to your API docs, categories are only supported in the GraphQL API, not the REST API. Here Iāve run into the following issues:
- No matter what I do, Iām not able to retrieve the category. The following query:
{
products(first: 10)
{
edges
{
node
{
id
title
handle
productCategory
{
productTaxonomyNode
{
fullName
}
}
variants(first:10) {
edges {
node
{
id
title
}
}
}
}
}
}
will return products with their variants, but the productCategory field is always null. Why is that? How can I get the category?
-
What about paging? In the old implementation using REST API we had implemented paging, and were grabbing the products 250 at a time. In the GraphQL API thereās the first(x) filter, and thereās an āafterā filter, which āReturns the elements that come after the specified cursor.ā But what is this cursor? How can I use this to implement paging?
-
How do I get the category hierarchy from a category? The productTaxonomyNode object has a fullName field. If the value of fullName is āLight Switchesā, how do I get the rest? Or will the fullName value be
2428 - Hardware > Power & Electrical Supplies > Electrical Switches > Light Switches
and I should split on the ā>ā symbol?
- Whatās with the query cost limitations? With the REST API we would retrieve 250 products with all their variants in one request. In GraphQL if I try to get as little as 70 products, with 10 variants, I get a message saying I exceeded the single query max cost limit. Not tom mention that while there are unlikely to be more than 10 variants, itās possible there will be more, and we need to make sure weāre retrieving all of them - we are actually importing the variants, not the products themselves. I donāt want to sound rude, but what good is this API if it has such severe performance limitations?