FROM CACHE - en_header

App Extension still sends Rest ID, How to switch to GID

Shopify Expert
4795 56 562

So this has come up a few times where we have the following:



A lot of people say nanny nanny booboo use the admin legacy ID but don't fake making a RestAPI into a GraphQL ID because heavens to Betsy one day Shopify might inventory numbers that don't coform to each format nicely.

So I go through all the trouble to craft a GraphQL App and need to access a product's metafields, but all I get from the App extension is the ID. The old skool Rest ID. So now how do I square that circle. Obviously I can fake it and turn into a GID with my helper, but that is not top notch computing. 

Can Shopify illuminate for us in the outer worlds how we are supposed to change the App setup so we get handed a GID for our work? Or is that not possible? Will it ever be possible?

Custom Shopify Apps built just for you!
Replies 5 (5)
Shopify Partner
1023 84 269
Shopify Expert
4795 56 562

Right,. As that article points out, there remains ZERO support for App Extensions in this area of work. Making them awkward to use.

Custom Shopify Apps built just for you!
New Member
2 0 0

Ridiculous isn't it.

I'm having the same issue and also can't go back to using the old REST API because the App Bridge components like Resource Picker are all using GraphQL ID...

I figure I'm just going to have to go against what the docs say and build the ID manually until something is done about it.

Shopify Staff
Shopify Staff
58 13 27

Hi all,

If you have the ID number you can use the `composeGid` method from '@shopify/admin-graphql-api-utilities' to construct the GraphQL ID.

See the docs for more info:

Trish | 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 the Shopify Help Center or the Shopify Blog

Shopify Expert
4795 56 562

Thanks Trish_Ta

The thing is, some of can only stomach a bare bare and I mean bare minimum of JS in our lives, so in my case, I ensure I only use JS where it is native and pretty much the only viable solution, the front-end.

And while I appreciate that JS has evolved (note sarcasm) to have a helper function to wipe one's butt, the fact is, we crafted the same helper in our backend scripting language. So yes, I too have a function that given an old legacy ID, will produce a gid string. But that continues to fly in the face of "That number might not be reliable in the future".

So we remain, at least with App Extensions, in the netherworld of faking things out!

But thanks on that JS hot tip! For the poor souls that make backend JS code, I am sure they will love it!

Custom Shopify Apps built just for you!