GraphQL query for ONLINE_STORE_MENU is not returing all menu items

GraphQL query for ONLINE_STORE_MENU is not returing all menu items

lakpura
Tourist
9 0 0

The following code should return first 100 menu items but it is only listing < 20 menu items. why is that?

 

{
translatableResources(first: 100, resourceType: ONLINE_STORE_MENU) {
edges {
node {
resourceId
translatableContent {
key
value
digest
locale
}
}
}
pageInfo {
endCursor
startCursor
hasNextPage
hasPreviousPage
}
}
}

Replies 5 (5)

Alan
Shopify Staff
129 15 25

Hey @lakpura - I was able to do a bit of testing using this query in my own testing environment and it returned the expected amount of Translatable Resources on my end. If we can confirm that there should be 100 or more menu items that can be translated on the store you're using this query on, and you're still not able to surface them we can definitely take a further look

 

To do that, if you could provide an X-Request-ID from the response headers you'd receive back from us, I can use that ID to dig a bit deeper into our logs to see if we can find out why the right amount of menu items aren't showing. 

 

Hope to hear from you soon - take care! 

Alan | API Support @ Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

lakpura
Tourist
9 0 0

Dear Alan - sure, X-Request-ID = b0a0d84a-1d24-4195-b67b-dd03dda44d6d

 

If you could see my site at https://lakpura.com my navigation menu has more then 30+ items but the GraphQL above only returns less than 20 records. I also have attached the JSON response i get for the above query.

lakpura
Tourist
9 0 0

@AlanI was wondering if you managed to look at the X-Request-ID = b0a0d84a-1d24-4195-b67b-dd03dda44d6d? I stuck on this to get my menu translated via API.

Alan
Shopify Staff
129 15 25

Hey @lakpura - thanks for your patience and for providing that Request ID. I was able to investigate a bit further on our end here and have some information I can confirm. Taking a look at the store that was associated with the API request, I was able to use our GraphQL API to do some testing on our end using the Translatable Resources object and can confirm how it works. 

 

Essentially, when you're referencing the "ONLINE_STORE_MENU" resource type, it's only going to show the actual menu category and not include any linked pages that are part of the menu. It will include any nested/submenu categories though. So, for instance, let's say I have a menu category called "Furniture" and then link to specific pages for each type of furniture. Shopify would consider these linked pages to be "ONLINE_STORE_PAGE" or "COLLECTION" objects rather than "Menu" objects. 

 

If I had a drop-down/nested menu category within a larger menu though, Shopify would consider that a "menu" object. There's a bit more on the different resource types here. I definitely understand where you're coming from here though - without that clarification it is a little confusing. Let me know if this makes sense or if we can clarify anything further for you on our end. 

Cheers!

Alan | API Support @ Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

lakpura
Tourist
9 0 0

@AlanYou are correct, all the menu links i was looking to translate were under the type LINK.