From 566407ff5e2bbdfb77779d0aa298dc0bc4042743 Mon Sep 17 00:00:00 2001 From: Traci Porter Date: Mon, 16 Dec 2024 10:46:00 -0600 Subject: [PATCH] Update examples per Rafal --- docs/storefront/graphql/orders.mdx | 67 ++++++++++++++++++++++-------- 1 file changed, 50 insertions(+), 17 deletions(-) diff --git a/docs/storefront/graphql/orders.mdx b/docs/storefront/graphql/orders.mdx index e27f6438c..88706b630 100644 --- a/docs/storefront/graphql/orders.mdx +++ b/docs/storefront/graphql/orders.mdx @@ -317,40 +317,73 @@ In this example, the query is set up to get details for order #106. Use `entityI ### Get an order metafield -In this example, the query is set up to get a metafield for order #1234000006. Use `entityId` to query by order. +In this example, the query is set up to get a metafield for order #102. Use `entityId` to query by order. ```graphql filename="Example query: Get order metafield" showLineNumbers copy - { - site { - order(filter: {entityId: 1234000006}) { - metafields(namespace: "namespace") { - edges { - node { - key - value - } + query Order($namespace: String!) { + site { + order(filter: {entityId: 102}) { + id + entityId + billingAddress { + firstName + } + metafields(namespace: $namespace) { + edges { + node { + key + value + } + } + } + cartMetafields(namespace: $namespace) { + edges { + node { + key + value } } } + } } + +} ``` ``` graphQL filename="Example response: Get order metafield" showLineNumbers copy { - "data": { - "site": { - "order": { - "metafields": { - "edges": [] - } - } + "data": { + "site": { + "order": { + "entityId": 102, + "metafields": { + "edges": [ + { + "node": { + "key": "Order metafield for order 102", + "value": "Order metafield for order 102" + } + } + ] + }, + "cartMetafields": { + "edges": [ + { + "node": { + "key": "Cart metafield for order 102", + "value": "Cart metafield for order 102" + } } + ] } + } } + } +} ```