Skip to content

Commit

Permalink
Add examples to orders page
Browse files Browse the repository at this point in the history
  • Loading branch information
bc-traciporter authored Dec 10, 2024
1 parent 61fd357 commit 75b8907
Showing 1 changed file with 105 additions and 0 deletions.
105 changes: 105 additions & 0 deletions docs/storefront/graphql/orders.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,111 @@ In this example, the query is set up to get details for order #106. Use `entityI
</Tab>
</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.

<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
}
}
}
}
}
}
```
</Tab>
<Tab>
``` graphQL filename="Example response: Get order metafield" showLineNumbers copy
{
"data": {
"site": {
"order": {
"metafields": {
"edges": []
}
}
}
}
}
```
</Tab>
</Tabs>

### Get metafields for a customer
In this example, the query is set up to get metafields for a customer. Ensure the customer is logged-in.

<Tabs items={[`Request`, `Response`]}>
<Tab>
```graphql filename="Example query: Get metafields" showLineNumbers copy
{
customer {
orders {
edges {
node {
entityId
metafields(namespace: "my-namespace") {
edges {
node {
value
}
}
}
}
}
}
}
}
```
</Tab>
<Tab>
```graphql filename="Example response: Get metafields" showLineNumbers copy
{
"data": {
"customer": {
"orders": {
"edges": [
{
"node": {
"entityId": 1234000006,
"metafields": {
"edges": []
}
}
},
{
"node": {
"entityId": 1234000005,
"metafields": {
"edges": []
}
}
},
{
"node": {
"entityId": 1234000004,
"metafields": {
"edges": []
}
}
}
]
}
}
}
}
```
</Tab>
</Tabs>

Join our [Developer community](/community) to share your feedback with us in the BigCommerceDevs Slack or on our Discord server.

## Resources
Expand Down

0 comments on commit 75b8907

Please sign in to comment.