You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: guides/v2.3/graphql/tutorials/checkout/checkout-shipping-address.md
+129Lines changed: 129 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -107,5 +107,134 @@ where
107
107
}
108
108
```
109
109
110
+
### Use for shipping a defined billing address
111
+
112
+
See [Add a new address for billing and shipping]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-billing-address.html) topic.
113
+
110
114
{:.bs-callout .bs-callout-info}
111
115
Send customer's authorization token in the `Authorization` parameter of the header if you set shipping address for a registered customer. See ["Get customer authorization token"]({{ page.baseurl }}/graphql/get-customer-authorization-token.html) to get more details.
116
+
117
+
### Use the existing customer's address
118
+
119
+
Use a query below to retrieve the list of customer addresses:
120
+
121
+
**Request**
122
+
123
+
```text
124
+
query {
125
+
customer {
126
+
addresses {
127
+
id
128
+
default_billing
129
+
default_shipping
130
+
}
131
+
}
132
+
}
133
+
```
134
+
135
+
**Response**
136
+
137
+
```text
138
+
{
139
+
"data": {
140
+
"customer": {
141
+
"addresses": [
142
+
{
143
+
"id": 2,
144
+
"default_billing": true,
145
+
"default_shipping": false
146
+
},
147
+
{
148
+
"id": 3,
149
+
"default_billing": false,
150
+
"default_shipping": false
151
+
},
152
+
{
153
+
"id": 4,
154
+
"default_billing": false,
155
+
"default_shipping": true
156
+
}
157
+
]
158
+
}
159
+
}
160
+
}
161
+
```
162
+
163
+
Define `customer_address_id` to assign the existing customer address.
164
+
165
+
**Request**
166
+
167
+
```text
168
+
mutation {
169
+
setShippingAddressesOnCart(
170
+
input: {
171
+
cart_id: "{{ CART_ID }}"
172
+
shipping_addresses: {
173
+
customer_address_id: {{ CUSTOMER_ADDRESS_ID }}
174
+
}
175
+
}
176
+
) {
177
+
cart {
178
+
shipping_addresses {
179
+
firstname
180
+
lastname
181
+
company
182
+
street
183
+
city
184
+
region {
185
+
code
186
+
label
187
+
}
188
+
postcode
189
+
telephone
190
+
country
191
+
{
192
+
code
193
+
label
194
+
}
195
+
address_type
196
+
}
197
+
}
198
+
}
199
+
}
200
+
```
201
+
202
+
where
203
+
`{{ CART_ID }}` - shopping cart unique ID from [Step 2. Create empty cart]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-add-product-to-cart.html).
204
+
`{{ CUSTOMER_ADDRESS_ID }}` - customer address ID (value from `entity_id` field of `customer_address_entity` table).
0 commit comments