# parseGid Parses [Shopify Global ID (GID)](https://shopify.dev/api/usage/gids) and returns the resource type and ID. ```js import {parseGid} from '@shopify/hydrogen'; const {id, resource} = parseGid('gid://shopify/Order/123'); console.log(id); // 123 console.log(resource); // Order ``` ## Props ### ParseGidGeneratedType #### Returns: ShopifyGid #### Params: - gid: string export function parseGid(gid: string | undefined): ShopifyGid { const defaultReturn = {id: '', resource: null}; if (typeof gid !== 'string') { return defaultReturn; } // TODO: add support for parsing query parameters on complex gids // Reference: https://shopify.dev/api/usage/gids const matches = gid.match(/^gid:\/\/shopify\/(\w+)\/([^/]+)/); if (!matches || matches.length === 1) { return defaultReturn; } const id = matches[2] ?? null; const resource = matches[1] ?? null; return {id, resource}; } ### ShopifyGid ### id value: `string` ### resource value: `string`