Fluent Commerce Logo
Docs
Sign In

GraphQL order by ID with flags in parameter

Essential knowledge

Author:

Holger Lierse

Changed on:

1 July 2024

Overview

Retrieve an order by

`id`
with flags to drive the retrieval of sub-entities.


Key points

  • Sample query on how to use flags as part of the query parameter

Inventory Position, Variant Product, Virtual Base & Aggregate Position

Retrieve inventory position, variant product, virtual base position and virtual aggregate position records based on input parameters.

Example Query:

1query getOrderById(
2    $id: ID!,
3    $includeCustomer: Boolean!,
4    $includeAttributes: Boolean!,
5    $includeFulfilmentChoice: Boolean!,
6    $includeFulfilments: Boolean!,
7    $includeOrderItems: Boolean!,
8    $includeArticles: Boolean!,
9    $includeConsignmentArticles: Boolean!,
10    $includeFinancialTransactions: Boolean!,
11    $articleCount: Int,
12    $articleCursor: String,
13    $fulfilmentItemCount: Int,
14    $fulfilmentItemCursor: String,
15    $fulfilmentCount: Int,
16    $fulfilmentCursor: String,
17    $orderItemCount: Int,
18    $orderItemCursor: String,
19    $financialTransactionsCount: Int,
20    $financialTransactionsCursor: String,
21    $consignmentArticlesCount: Int,
22    $consignmentArticlesCursor: String) {
23  order: orderById(id: $id) {
24    id
25    ref
26    type
27    status
28    createdOn
29    updatedOn
30    totalPrice
31    totalTaxPrice
32    attributes @include(if: $includeAttributes) {
33      name
34      value
35      type
36    }
37    financialTransactions(first: $financialTransactionsCount, after: $financialTransactionsCursor) @include(if: $includeFinancialTransactions) {
38      edges {
39        node {
40          id
41          ref
42          type
43          status
44          createdOn
45          updatedOn
46          total
47          currency
48          externalTransactionCode
49          externalTransactionId
50          cardType
51          paymentMethod
52          paymentProviderName
53        }
54        cursor
55      }
56      pageInfo {
57        hasNextPage
58      }
59    }
60 
61    items(first: $orderItemCount, after: $orderItemCursor) @include(if: $includeOrderItems) {
62      itemEdges: edges {
63        itemNode: node {
64          id
65          ref
66          quantity
67          paidPrice
68          currency
69          price
70          taxPrice
71          totalPrice
72          totalTaxPrice
73          status
74 
75          product {
76            ... on VariantProduct {
77              ref
78              name
79              summary
80              catalogue {
81                ref
82              }
83            }
84          }
85          attributes{
86            name
87            type
88            value
89          }
90        }
91        cursor
92      }
93      pageInfo {
94        hasNextPage
95      }
96    }
97    fulfilments(first: $fulfilmentCount, after: $fulfilmentCursor) @include(if: $includeFulfilments) {
98      fulfilmentEdges: edges {
99        fulfilmentNode: node {
100          id
101          ref
102          type
103          status
104          type
105          createdOn
106          updatedOn
107          fromAddress {
108            ref
109            id
110            name
111          }
112          toAddress {
113            ref
114            id
115          }
116          attributes{
117            name
118            type
119            value
120          }
121          fulfilmentItems: items(first: $fulfilmentItemCount, after: $fulfilmentItemCursor) {
122            fulfilmentItemEdges: edges {
123              fulfilmentItemNode: node {
124                id
125                ref
126                status
127                requestedQuantity
128                filledQuantity
129                rejectedQuantity
130                orderItem {
131                  id
132                  ref
133                  status
134                  quantity
135                  paidPrice
136                  currency
137                  price
138                  taxPrice
139                  taxType
140                  totalPrice
141                  totalTaxPrice
142 
143                  attributes{
144                    name
145                    type
146                    value
147                  }
148                  product {
149                    ... on VariantProduct {
150                      name
151                      ref
152                      gtin
153                      summary
154                      type
155                      prices{
156                        value
157                      }
158                      catalogue{
159                        id
160                        ref
161                      }
162                   }
163                }
164                }
165              }
166              cursor
167            }
168            pageInfo {
169              hasNextPage
170            }
171          }
172          articles(first: $articleCount, after: $articleCursor) @include(if: $includeArticles) {
173            edges {
174              node {
175                id
176                ref
177                type
178                status
179                quantity
180                carrierConsignmentArticles(first: $consignmentArticlesCount, after: $consignmentArticlesCursor) @include(if: $includeConsignmentArticles) {
181                  edges {
182                    node {
183                      carrierConsignment {
184                        id
185                        ref
186                        trackingLabel
187                        labelUrl
188                        orderSummaryUrl
189                        carrier {
190                          id
191                          name
192                          ref
193                        }
194                      }
195                    }
196                  }
197                }
198              }
199              cursor
200            }
201            pageInfo {
202              hasNextPage
203            }
204          }
205        }
206        cursor
207      }
208      pageInfo {
209        hasNextPage
210      }
211    }
212    customer @include(if: $includeCustomer) {
213      id
214      ref
215      title
216      country
217      firstName
218      lastName
219      username
220      primaryEmail
221      primaryPhone
222    }
223    fulfilmentChoice @include(if: $includeFulfilmentChoice) {
224      id
225      createdOn
226      updatedOn
227      currency
228      deliveryInstruction
229      fulfilmentPrice
230      deliveryType
231      fulfilmentPrice
232      fulfilmentType
233      fulfilmentTaxPrice
234      pickupLocationRef
235      deliveryAddress {
236        id
237        type
238        companyName
239        name
240        street
241        city
242        state
243        postcode
244        region
245        country
246        region
247        ref
248        latitude
249        longitude
250      }
251    }
252  }
253}

Language: json

Name: getOrderById - query

Description:

getOrderById - query

Example Parameters:

1{
2  "id": 133,
3  "includeArticles": false,
4  "includeCustomer": false,
5  "includeOrderItems": true,
6  "includeAttributes": true,
7  "includeFulfilments": false,
8  "includeFulfilmentChoice": false,
9  "includeConsignmentArticles": false,
10  "includeFinancialTransactions": false,
11  "articleCount": 100,
12  "fulfilmentCount": 100,
13  "fulfilmentItemCount": 100,
14  "orderItemCount": 100,
15  "financialTransactionsCount": 100,
16  "consignmentArticlesCount": 100
17}

Language: json

Name: getOrderById - Parameter

Description:

getOrderById - Parameter


Copyright © 2024 Fluent Retail Pty Ltd (trading as Fluent Commerce). All rights reserved. No materials on this docs.fluentcommerce.com site may be used in any way and/or for any purpose without prior written authorisation from Fluent Commerce. Current customers and partners shall use these materials strictly in accordance with the terms and conditions of their written agreements with Fluent Commerce or its affiliates.

Fluent Logo