Shopify Glossary Terms

GROQ

GROQ (Graph-Relational Object Queries) is Sanity's query language for fetching content. It's purpose-built for querying structured content and is significantly more flexible than the REST APIs most CMSs offer.

The key advantage for developers is precision. You can request exactly the data you need for each page - specific fields, resolved references, computed values, filtered results - in a single query. No over-fetching (getting data you don't need) and no under-fetching (needing multiple requests to assemble what you need). This translates directly to faster page loads because you're only pulling the content that matters for each render.

GROQ syntax looks like this: *[_type == "product" && category == "shoes"]{title, price, "image": mainImage.asset->url}. It queries all products of type "shoes" and returns just the title, price, and image URL. If you're familiar with GraphQL, GROQ solves similar problems but with a different syntax that many developers find more intuitive for content queries.


Think: the query language that fetches only the content each page actually needs.

A Shopify Plus Agency for Strategic Design & Advanced Engineering

Building something ambitious?

Chosen by Shopify Plus brands worldwide.

{"@context":"https://schema.org","@graph":[{"@type":"Article","headline":"GROQ","description":"GROQ is Sanity CMS's query language for fetching structured content. Precise data fetching with no over-fetching for faster headless storefronts.","author":{"@type":"Organization","name":"Flux Agency","url":"https://flux.agency"},"publisher":{"@type":"Organization","name":"Flux Agency","url":"https://flux.agency","logo":{"@type":"ImageObject","url":"https://cdn.prod.website-files.com/69ac35019ce8f68774055c5e/69ad8912209a3b56e3865820_FLUXw.svg"}},"mainEntityOfPage":{"@type":"WebPage","@id":"https://flux.agency/glossary/groq"},"datePublished":"2026-03-26","dateModified":"2026-04-10"},{"@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://flux.agency"},{"@type":"ListItem","position":2,"name":"Glossary","item":"https://flux.agency/glossary"},{"@type":"ListItem","position":3,"name":"GROQ","item":"https://flux.agency/glossary/groq"}]},{"@type":"FAQPage","mainEntity":[{"@type":"Question","name":"What is GROQ?","acceptedAnswer":{"@type":"Answer","text":"GROQ (Graph-Relational Object Queries) is Sanity's query language for fetching content. It lets you request exactly the data you need for each page - specific fields, resolved references, computed values, filtered results - in a single query with no over-fetching or under-fetching."}},{"@type":"Question","name":"How is GROQ different from GraphQL?","acceptedAnswer":{"@type":"Answer","text":"GROQ and GraphQL solve similar problems but with different syntax. Many developers find GROQ more intuitive for content queries. GROQ is purpose-built for querying structured content in Sanity, while GraphQL is a general-purpose API query language used across many platforms including Shopify."}},{"@type":"Question","name":"Why does GROQ matter for headless Shopify performance?","acceptedAnswer":{"@type":"Answer","text":"GROQ queries return only the content fields each page actually needs. No excess data is transferred, which means faster page loads. For headless Shopify builds using Sanity, efficient GROQ queries directly reduce the content payload and improve time-to-first-byte."}}]}]}