Skip to content

Commit

Permalink
Update examples per Rafal
Browse files Browse the repository at this point in the history
  • Loading branch information
bc-traciporter authored Dec 16, 2024
1 parent 75b8907 commit 566407f
Showing 1 changed file with 50 additions and 17 deletions.
67 changes: 50 additions & 17 deletions docs/storefront/graphql/orders.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -317,40 +317,73 @@ In this example, the query is set up to get details for order #106. Use `entityI
</Tabs>

### 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.

<Tabs items={[`Request`, `Response`]}>
<Tab>
```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
}
}
}

}
}

}
```
</Tab>
<Tab>
``` 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"
}
}
]
}
}
}
}
}
```
</Tab>
</Tabs>
Expand Down

0 comments on commit 566407f

Please sign in to comment.