Fluent Commerce Logo
Docs
Sign In

orderBillingAddress graphQL query and mutation

Essential knowledge

Author:

Fluent Commerce

Changed on:

23 Nov 2023

Overview

The

`orderBillingAddress`
(aka
`billingAddress`
) is a sub-entity of the Order entity. A customer can optionally add a billing address while ordering items from a store, so an Order can store one
`billingAddress`
as an attribute.

Key points

  • The page provides GQL example of how to use
    `orderBillingAddress`
    :
    • Create
    • Update
    • Query

Create

1POST: {{fluentApiHost}}/graphql
2
3## Query:
4
5mutation CreateOrder ($retailerId:ID!,
6$productCatalogueRef:String!, 
7$customerId:ID!,
8$ccLocRef:String!) {
9  createOrder(input: {
10        ref: "CC_{{$randomInt}}{{$randomInt}}"
11        retailer: { id:$retailerId }
12        type: "CC"
13        customer: { id:$customerId }
14    	totalPrice:29000.00
15        items: [{
16            ref: "BIG_LIPSTICK5P1A"
17            productRef: "BIG_LIPSTICK5P"
18            productCatalogueRef:$productCatalogueRef
19            price: 14.00
20            paidPrice:12.00
21            totalPrice:60.00
22            taxPrice:1.00
23            totalTaxPrice: 6.00
24            quantity:6
25          	currency:"AUD"
26            attributes:[
27              ]
28        }       
29        ],
30        billingAddress: {
31            name:"bill name"
32            companyName:"bill companyName"
33            city:"bill city"
34            country:"bill country"
35            email:"bill@email.com"
36            latitude:1
37            longitude:2
38            postcode:"bill postcode"
39            region:"bill region"
40            state:"bill state"
41            street:"bill street"
42            street2:"bill street 2"
43            timeZone:"GMT+10"
44        }
45        fulfilmentChoice: {
46            currency: "AUD"
47            deliveryType: "STANDARD"
48            fulfilmentPrice:5.00
49            fulfilmentTaxPrice:0.50
50            fulfilmentType: "CC_PFS"
51            pickupLocationRef: $ccLocRef
52        }
53    }) {
54        id
55        attributes{
56            name
57            type
58            value
59        }
60    }
61}
62
63
64
65
66
67## Variable:
68{
69	"retailerId": {{retailer_id}},
70	"productCatalogueRef": "PC:MASTER:199",
71	"customerId": {{last_customer_id}},
72	"ccLocRef": "199_MEL"
73}
74
75
76
77
78
79

Language: graphqlschema

Name: Create orderBillingAddress GQL example. (OrderBillingAddress is part of the createOrder mutation)

Description:

[Warning: empty required content area]


Update

1POST: {{fluentApiHost}}/graphql
2
3#Query:
4
5mutation updateOrder ($input: UpdateOrderInput) {
6    updateOrder (input: $input) {
7        id
8        ref
9        type
10        status
11        createdOn
12        updatedOn
13        billingAddress{
14                    id
15                    city
16                    companyName
17                    country
18                    createdOn
19                    email
20                    latitude
21                    longitude
22                    name
23                    postcode
24                    region
25                    state
26                    street
27                    street2
28                    timeZone
29                    updatedOn
30                }        
31
32
33    }
34}
35
36#Variables:
37
38{
39  "input": {
40    "id": 5004505,
41    "billingAddress": {
42            "id": 7,
43            "city": "bill city22",
44            "companyName": "bill companyName22",
45            "country": "bill country22",
46            "email": "bill@email.com22",
47            "latitude": 1.02,
48            "longitude": 2.02,
49            "name": "bill name2",
50            "postcode": "bill postcode22",
51            "region": "bill region22",
52            "state": "bill state22",
53            "street": "bill street22",
54            "street2": "bill street 22222",
55            "timeZone": "GMT+102"
56        }
57    }
58}

Language: plain_text

Name: Update orderBillingAddress GQL example. (Update billingAddress can be done via updateOrder mutation)

Description:

[Warning: empty required content area]


Query

1POST: {{fluentApiHost}}/graphql
2
3Query:
4
5{
6    orderBillingAddresses(first:4, name:"bill name"){
7        edges{
8            node{
9                city
10                companyName
11                country
12                createdOn
13                email
14                id
15                latitude
16                longitude
17                name
18                postcode
19                region
20                state
21                street
22                street2
23                timeZone
24                updatedOn
25
26            }
27        }
28    }
29}

Language: graphqlschema

Name: Sample Query of direct query orderBillingAddress

Description:

[Warning: empty required content area]

Alternatively, you can query it via query Order:

1POST: {{fluentApiHost}}/graphql
2
3Query:
4
5{
6    orders(first:10){
7        edges{
8            node{
9                id
10                ref
11                status
12                type
13                createdOn
14                updatedOn
15                billingAddress{
16                    id
17                    city
18                    companyName
19                    country
20                    createdOn
21                    email
22                    latitude
23                    longitude
24                    name
25                    postcode
26                    region
27                    state
28                    street
29                    street2
30                    timeZone
31                    updatedOn
32                }
33            }
34        }
35    }
36}

Language: plain_text

Name: orderBillingAddress GQL example 2

Description:

[Warning: empty required content area]
Fluent Commerce

Fluent Commerce

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