parse Gidgear
gear
Parses Shopify Global ID (GID) and returns the resource type and ID.
Anchor to parseGid-parametersParameters
- stringrequired
A shopify GID (string)
Anchor to parseGid-returnsReturns
ShopifyGid
ShopifyGid
Pick<URL, 'search' | 'searchParams' | 'hash'> & {
id: string;
resource: string | null;
resourceId: string | null;
}
ShopifyGid
Pick<URL, 'search' | 'searchParams' | 'hash'> & {
id: string;
resource: string | null;
resourceId: string | null;
}Was this section helpful?
Example code
JavaScript
import {parseGid} from '@shopify/hydrogen';
const {id, resource} = parseGid('gid://shopify/Order/123');
console.log(id); // 123
console.log(resource); // Order
Examples
Example code
Description
I am the default example
JavaScript
import {parseGid} from '@shopify/hydrogen'; const {id, resource} = parseGid('gid://shopify/Order/123'); console.log(id); // 123 console.log(resource); // Order