Version: 2024-10
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/api/2024-10/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Storefront-Access-Token: {storefront_access_token}' \\\n-d '{\n\"query\": \"query productRecommendations($productId: ID!) { productRecommendations(productId: $productId) { id } }\"\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 productRecommendations($productId: ID!) {\n productRecommendations(productId: $productId) {\n id\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 productRecommendations($productId: ID!) {\n productRecommendations(productId: $productId) {\n id\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 productRecommendations($productId: ID!) {\n productRecommendations(productId: $productId) {\n id\n }\n }`,\n);\n\nconst data = await response.json();\n" Graphql query: "query productRecommendations($productId: ID!) {\n productRecommendations(productId: $productId) {\n id\n }\n}"
input: null
response: { "data": { "productRecommendations": [ { "id": "gid://shopify/Product/538825261" }, { "id": "gid://shopify/Product/263071856" }, { "id": "gid://shopify/Product/65721165" } ] } }
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/api/2024-10/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Storefront-Access-Token: {storefront_access_token}' \\\n-d '{\n\"query\": \"query getComplementaryProductRecommendations($productId: ID!, $intent: ProductRecommendationIntent!) { productRecommendations(productId: $productId, intent: $intent) { id } }\"\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 getComplementaryProductRecommendations($productId: ID!, $intent: ProductRecommendationIntent!) {\n productRecommendations(productId: $productId, intent: $intent) {\n id\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 getComplementaryProductRecommendations($productId: ID!, $intent: ProductRecommendationIntent!) {\n productRecommendations(productId: $productId, intent: $intent) {\n id\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 getComplementaryProductRecommendations($productId: ID!, $intent: ProductRecommendationIntent!) {\n productRecommendations(productId: $productId, intent: $intent) {\n id\n }\n }`,\n);\n\nconst data = await response.json();\n" Graphql query: "query getComplementaryProductRecommendations($productId: ID!, $intent: ProductRecommendationIntent!) {\n productRecommendations(productId: $productId, intent: $intent) {\n id\n }\n}"
input: null
response: { "data": { "productRecommendations": [ { "id": "gid://shopify/Product/263071856" } ] } }