Skip to main content

parseGid

Parses Shopify Global ID (GID) and returns the resource type and ID.

Parses global id (gid) and returns the resource type and id.

string
required

A shopify GID (string)

Examples

JavaScript

import {parseGid} from '@shopify/hydrogen';

const {id, resource} = parseGid('gid://shopify/Order/123');

console.log(id); // 123
console.log(resource); // Order

Was this page helpful?