Version: 2024-01
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/api/2024-01/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Storefront-Access-Token: {storefront_access_token}' \\\n-d '{\n\"query\": \"query searchProducts($query: String!, $first: Int) { search(query: $query, first: $first, types: PRODUCT) { edges { node { ... on Product { id title } } } } }\"\n}'\n" Node example: "const client = new shopify.clients.Storefront({\n domain: 'your-development-store.myshopify.com',\n storefrontAccessToken,\n});\nconst data = await client.query({\n data: `query searchProducts($query: String!, $first: Int) {\n search(query: $query, first: $first, types: PRODUCT) {\n edges {\n node {\n ... on Product {\n id\n title\n }\n }\n }\n }\n }`,\n});\n" Ruby example: null PHP example: "use Shopify\\Clients\\Graphql;\n\n$client = new ShopifyClientsStorefront(\"your-development-store.myshopify.com\", $storefrontAccessToken);\n$query = <<<QUERY\n query searchProducts($query: String!, $first: Int) {\n search(query: $query, first: $first, types: PRODUCT) {\n edges {\n node {\n ... on Product {\n id\n title\n }\n }\n }\n }\n }\nQUERY;\n\n$response = $client->query([\"query\" => $query]);\n" Remix example: "const { storefront } = await unauthenticated.storefront(\n 'your-development-store.myshopify.com'\n);\n\nconst response = await storefront.graphql(\n `#graphql\n query searchProducts($query: String!, $first: Int) {\n search(query: $query, first: $first, types: PRODUCT) {\n edges {\n node {\n ... on Product {\n id\n title\n }\n }\n }\n }\n }`,\n);\n\nconst data = await response.json();\n" Graphql query: "query searchProducts($query: String!, $first: Int) {\n search(query: $query, first: $first, types: PRODUCT) {\n edges {\n node {\n ... on Product {\n id\n title\n }\n }\n }\n }\n}"
input: null
response: { "data": { "search": { "edges": [ { "node": { "id": "gid://shopify/Product/1", "title": "The Toggle Snowboard" } }, { "node": { "id": "gid://shopify/Product/2", "title": "The .dev Snowboard" } }, { "node": { "id": "gid://shopify/Product/3", "title": "The Hydrogen Snowboard" } } ] } } }
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/api/2024-01/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Storefront-Access-Token: {storefront_access_token}' \\\n-d '{\n\"query\": \"query searchAll($query: String!, $first: Int) { search(query: $query, first: $first, types: [PRODUCT, PAGE, ARTICLE]) { edges { node { ... on Product { id title } ... on Page { id title } ... on Article { id title } } } } }\"\n}'\n" Node example: "const client = new shopify.clients.Storefront({\n domain: 'your-development-store.myshopify.com',\n storefrontAccessToken,\n});\nconst data = await client.query({\n data: `query searchAll($query: String!, $first: Int) {\n search(query: $query, first: $first, types: [PRODUCT, PAGE, ARTICLE]) {\n edges {\n node {\n ... on Product {\n id\n title\n }\n ... on Page {\n id\n title\n }\n ... on Article {\n id\n title\n }\n }\n }\n }\n }`,\n});\n" Ruby example: null PHP example: "use Shopify\\Clients\\Graphql;\n\n$client = new ShopifyClientsStorefront(\"your-development-store.myshopify.com\", $storefrontAccessToken);\n$query = <<<QUERY\n query searchAll($query: String!, $first: Int) {\n search(query: $query, first: $first, types: [PRODUCT, PAGE, ARTICLE]) {\n edges {\n node {\n ... on Product {\n id\n title\n }\n ... on Page {\n id\n title\n }\n ... on Article {\n id\n title\n }\n }\n }\n }\n }\nQUERY;\n\n$response = $client->query([\"query\" => $query]);\n" Remix example: "const { storefront } = await unauthenticated.storefront(\n 'your-development-store.myshopify.com'\n);\n\nconst response = await storefront.graphql(\n `#graphql\n query searchAll($query: String!, $first: Int) {\n search(query: $query, first: $first, types: [PRODUCT, PAGE, ARTICLE]) {\n edges {\n node {\n ... on Product {\n id\n title\n }\n ... on Page {\n id\n title\n }\n ... on Article {\n id\n title\n }\n }\n }\n }\n }`,\n);\n\nconst data = await response.json();\n" Graphql query: "query searchAll($query: String!, $first: Int) {\n search(query: $query, first: $first, types: [PRODUCT, PAGE, ARTICLE]) {\n edges {\n node {\n ... on Product {\n id\n title\n }\n ... on Page {\n id\n title\n }\n ... on Article {\n id\n title\n }\n }\n }\n }\n}"
input: null
response: { "data": { "search": { "edges": [ { "node": { "id": "gid://shopify/Product/1", "title": "The Toggle Snowboard" } }, { "node": { "id": "gid://shopify/Page/1", "title": "Snowdevil is not your typical snowboard store" } }, { "node": { "id": "gid://shopify/Article/1", "title": "10 Tips for Better Snowboarding" } } ] } } }
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/api/2024-01/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Storefront-Access-Token: {storefront_access_token}' \\\n-d '{\n\"query\": \"query searchWithFilters($query: String!, $first: Int, $productFilters: [ProductFilter!]) { search(query: $query, first: $first, productFilters: $productFilters) { edges { node { ... on Product { id title vendor } } } } }\"\n}'\n" Node example: "const client = new shopify.clients.Storefront({\n domain: 'your-development-store.myshopify.com',\n storefrontAccessToken,\n});\nconst data = await client.query({\n data: `query searchWithFilters($query: String!, $first: Int, $productFilters: [ProductFilter!]) {\n search(query: $query, first: $first, productFilters: $productFilters) {\n edges {\n node {\n ... on Product {\n id\n title\n vendor\n }\n }\n }\n }\n }`,\n});\n" Ruby example: null PHP example: "use Shopify\\Clients\\Graphql;\n\n$client = new ShopifyClientsStorefront(\"your-development-store.myshopify.com\", $storefrontAccessToken);\n$query = <<<QUERY\n query searchWithFilters($query: String!, $first: Int, $productFilters: [ProductFilter!]) {\n search(query: $query, first: $first, productFilters: $productFilters) {\n edges {\n node {\n ... on Product {\n id\n title\n vendor\n }\n }\n }\n }\n }\nQUERY;\n\n$response = $client->query([\"query\" => $query]);\n" Remix example: "const { storefront } = await unauthenticated.storefront(\n 'your-development-store.myshopify.com'\n);\n\nconst response = await storefront.graphql(\n `#graphql\n query searchWithFilters($query: String!, $first: Int, $productFilters: [ProductFilter!]) {\n search(query: $query, first: $first, productFilters: $productFilters) {\n edges {\n node {\n ... on Product {\n id\n title\n vendor\n }\n }\n }\n }\n }`,\n);\n\nconst data = await response.json();\n" Graphql query: "query searchWithFilters($query: String!, $first: Int, $productFilters: [ProductFilter!]) {\n search(query: $query, first: $first, productFilters: $productFilters) {\n edges {\n node {\n ... on Product {\n id\n title\n vendor\n }\n }\n }\n }\n}"
input: null
response: { "data": { "search": { "edges": [ { "node": { "id": "gid://shopify/Product/1", "title": "The Toggle Snowboard", "vendor": "Snowdevil" } }, { "node": { "id": "gid://shopify/Product/2", "title": "The .dev Snowboard", "vendor": "Snowdevil" } }, { "node": { "id": "gid://shopify/Product/3", "title": "The Hydrogen Snowboard", "vendor": "Snowdevil" } } ] } } }
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/api/2024-01/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Storefront-Access-Token: {storefront_access_token}' \\\n-d '{\n\"query\": \"query facets($query: String!, $first: Int) { search(query: $query, first: $first) { productFilters { id label type values { id label count input } } } }\"\n}'\n" Node example: "const client = new shopify.clients.Storefront({\n domain: 'your-development-store.myshopify.com',\n storefrontAccessToken,\n});\nconst data = await client.query({\n data: `query facets($query: String!, $first: Int) {\n search(query: $query, first: $first) {\n productFilters {\n id\n label\n type\n values {\n id\n label\n count\n input\n }\n }\n }\n }`,\n});\n" Ruby example: null PHP example: "use Shopify\\Clients\\Graphql;\n\n$client = new ShopifyClientsStorefront(\"your-development-store.myshopify.com\", $storefrontAccessToken);\n$query = <<<QUERY\n query facets($query: String!, $first: Int) {\n search(query: $query, first: $first) {\n productFilters {\n id\n label\n type\n values {\n id\n label\n count\n input\n }\n }\n }\n }\nQUERY;\n\n$response = $client->query([\"query\" => $query]);\n" Remix example: "const { storefront } = await unauthenticated.storefront(\n 'your-development-store.myshopify.com'\n);\n\nconst response = await storefront.graphql(\n `#graphql\n query facets($query: String!, $first: Int) {\n search(query: $query, first: $first) {\n productFilters {\n id\n label\n type\n values {\n id\n label\n count\n input\n }\n }\n }\n }`,\n);\n\nconst data = await response.json();\n" Graphql query: "query facets($query: String!, $first: Int) {\n search(query: $query, first: $first) {\n productFilters {\n id\n label\n type\n values {\n id\n label\n count\n input\n }\n }\n }\n}"
input: null
response: { "data": { "search": { "productFilters": [ { "id": "filter.v.availability", "label": "Availability", "type": "LIST", "values": [ { "id": "filter.v.availability.1", "label": "In stock", "count": 56, "input": "{\"available\":true}" }, { "id": "filter.v.availability.0", "label": "Out of stock", "count": 6, "input": "{\"available\":false}" } ] }, { "id": "filter.v.price", "label": "Price", "type": "PRICE_RANGE", "values": [ { "id": "filter.v.price", "label": "Price", "count": 0, "input": "{\"price\":{\"min\":0,\"max\":2629.95}}" } ] }, { "id": "filter.p.product_type", "label": "Product type", "type": "LIST", "values": [ { "id": "filter.p.product_type.snowboards", "label": "Snowboards", "count": 56, "input": "{\"productType\":\"Snowboards\"}" } ] }, { "id": "filter.p.vendor", "label": "Brand", "type": "LIST", "values": [ { "id": "filter.p.vendor.snowdevil", "label": "Snowdevil", "count": 56, "input": "{\"productVendor\":\"Snowdevil\"}" } ] }, { "id": "filter.v.option.binding mount", "label": "Binding mount", "type": "LIST", "values": [ { "id": "filter.v.option.binding mount.nested", "label": "Nested", "count": 1, "input": "{\"variantOption\":{\"name\":\"binding mount\",\"value\":\"Nested\"}}" }, { "id": "filter.v.option.binding mount.optimistic", "label": "Optimistic", "count": 1, "input": "{\"variantOption\":{\"name\":\"binding mount\",\"value\":\"Optimistic\"}}" } ] }, { "id": "filter.v.option.color", "label": "Color", "type": "LIST", "values": [ { "id": "filter.v.option.color.fed-green", "label": "FED Green", "count": 45, "input": "{\"variantOption\":{\"name\":\"color\",\"value\":\"FED Green\"}}" }, { "id": "filter.v.option.color.reactive-blue", "label": "Reactive Blue", "count": 5, "input": "{\"variantOption\":{\"name\":\"color\",\"value\":\"Reactive Blue\"}}" }, { "id": "filter.v.option.color.sea-green-desert", "label": "Sea Green / Desert", "count": 1, "input": "{\"variantOption\":{\"name\":\"color\",\"value\":\"Sea Green \\/ Desert\"}}" }, { "id": "filter.v.option.color.syntax", "label": "Syntax", "count": 2, "input": "{\"variantOption\":{\"name\":\"color\",\"value\":\"Syntax\"}}" } ] }, { "id": "filter.v.option.material", "label": "Material", "type": "LIST", "values": [ { "id": "filter.v.option.material.carbon-fiber", "label": "Carbon-fiber", "count": 1, "input": "{\"variantOption\":{\"name\":\"material\",\"value\":\"Carbon-fiber\"}}" }, { "id": "filter.v.option.material.fiberglass", "label": "Fiberglass", "count": 1, "input": "{\"variantOption\":{\"name\":\"material\",\"value\":\"Fiberglass\"}}" }, { "id": "filter.v.option.material.kevlar", "label": "Kevlar®", "count": 1, "input": "{\"variantOption\":{\"name\":\"material\",\"value\":\"Kevlar®\"}}" }, { "id": "filter.v.option.material.polycarbonate", "label": "Polycarbonate", "count": 1, "input": "{\"variantOption\":{\"name\":\"material\",\"value\":\"Polycarbonate\"}}" }, { "id": "filter.v.option.material.polyethylene", "label": "Polyethylene", "count": 1, "input": "{\"variantOption\":{\"name\":\"material\",\"value\":\"Polyethylene\"}}" }, { "id": "filter.v.option.material.ultra-high-molecular-weight-polyethylene", "label": "Ultra-high-molecular-weight polyethylene", "count": 1, "input": "{\"variantOption\":{\"name\":\"material\",\"value\":\"Ultra-high-molecular-weight polyethylene\"}}" }, { "id": "filter.v.option.material.vectran", "label": "Vectran®", "count": 1, "input": "{\"variantOption\":{\"name\":\"material\",\"value\":\"Vectran®\"}}" }, { "id": "filter.v.option.material.wood-composite", "label": "Wood-composite", "count": 1, "input": "{\"variantOption\":{\"name\":\"material\",\"value\":\"Wood-composite\"}}" } ] }, { "id": "filter.v.option.size", "label": "Size", "type": "LIST", "values": [ { "id": "filter.v.option.size.154cm", "label": "154cm", "count": 56, "input": "{\"variantOption\":{\"name\":\"size\",\"value\":\"154cm\"}}" }, { "id": "filter.v.option.size.158cm", "label": "158cm", "count": 55, "input": "{\"variantOption\":{\"name\":\"size\",\"value\":\"158cm\"}}" }, { "id": "filter.v.option.size.160cm", "label": "160cm", "count": 56, "input": "{\"variantOption\":{\"name\":\"size\",\"value\":\"160cm\"}}" }, { "id": "filter.v.option.size.170cm", "label": "170cm", "count": 1, "input": "{\"variantOption\":{\"name\":\"size\",\"value\":\"170cm\"}}" } ] }, { "id": "filter.p.m.metafields-tests.boolean", "label": "boolean", "type": "BOOLEAN", "values": [ { "id": "filter.p.m.metafields-tests.boolean.0", "label": "No", "count": 1, "input": "{\"productMetafield\":{\"namespace\":\"metafields-tests\",\"key\":\"boolean\",\"value\":\"false\"}}" } ] } ] } } }