Skip to main content

Fetch a product by slug

Retrieve a product using its URL-friendly slug. Useful when resolving storefront URLs.

Query

query GetProductBySlug($slug: String!, $language: String!) {
product(slug: $slug, language: $language) {
productId
sku
names { language value }
slugs { language value }
}
}

Variables

{
"slug": "hp-probook-450",
"language": "NL"
}

Response

{
"data": {
"product": {
"productId": 1895,
"sku": "HP-450G10-I5",
"names": [
{ "language": "NL", "value": "HP ProBook 450 G10 i5" }
],
"slugs": [
{ "language": "NL", "value": "hp-probook-450" }
]
}
}
}

How it works

Slugs can differ per language. Pass the language variable to match the correct localized slug. If you omit language, the system matches against the default language.

See also