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
import MoveFulfillmentOrders from '@site/_snippets/_moving-fulfillment-orders.mdx';
8
9
9
10
Order management operations can be automated through the Admin API for more efficient operations and bulk actions on large quanities of orders.
10
11
11
12
Below are best practices and guides for common scenarios merchants and partners use to manage orders on the Admin API.
12
13
13
14
15
+
### Order Items Editing
16
+
17
+
Editing items on an order is common practice, such as swapping products purchased for a different size or color with the same value without needing to collect payment or create a refund.
18
+
19
+
:::info Only Available on 2024-04-01 API Version
20
+
Order editing APIs are only available on 2024-04-01 API Version and above, if you are still using older versions we recommend you upgrade your integration.
21
+
22
+
Order editing APIs also do not affect order payment within each request. To remove items with an associated refund, see [order refunds](#order-refunds). Using order edit APIs can result in the customer owing or the merchant owing to the customer.
23
+
:::
24
+
25
+
#### Line Item Quantities Explained
26
+
27
+
Order line items have 4 quantity attributes that represent quantities at different states in an order life cycle.
28
+
29
+
-`quantity` - Item quantity total ever added to the order in this line.
30
+
-`current_quantity` - Current item quantity that have not yet been removed.
31
+
-`fulfillable_quantity` - Item quantity that have not yet been fulfilled, such as a partial fulfillment.
32
+
-`editable_quantity` - Item quantity that currently can be edited.
33
+
34
+
```json title="Line Item Quantities Explained"
35
+
"lines": [
36
+
{
37
+
...
38
+
"quantity": 3, // quantity of items ever added
39
+
"current_quantity": 2, // current quantity that have not been removed
40
+
"fulfillable_quantity": 1, // quantity that have not yet been fulfilled
41
+
"editable_quantity": 1, // quantity that can be edited
42
+
...
43
+
}
44
+
]
45
+
```
46
+
47
+
### Swap Items Flow
48
+
49
+
```mermaid
50
+
stateDiagram-v2
51
+
direction LR
52
+
lines: Retrieve Order Lines
53
+
removeLine: Remove Unwanted Items
54
+
addLine: Add New Items
55
+
collectPayment: Collect Payment
56
+
lines --> removeLine
57
+
removeLine --> addLine
58
+
addLine --> collectPayment
59
+
```
60
+
61
+
Swapping Items on an order is a 4 step process:
62
+
63
+
1. Retrieve order line items using the [ordersRetrieve](/docs/api/admin/reference/?v=2024-04-01#/operations/ordersRetrieve) endpoint and check `editable_quantity` is > 0.
64
+
2. Update/Remove line items using the [ordersLinesPartialUpdate](/docs/api/admin/reference/?v=2024-04-01#/operations/ordersLinesPartialUpdate) or [ordersLinesDestroy](/docs/api/admin/reference/?v=2024-04-01#/operations/ordersLinesDestroy) endpoint.
65
+
3. Create new line item [ordersLinesCreate](/docs/api/admin/reference/?v=2024-04-01#/operations/ordersLinesCreate) endpoint.
66
+
4.[Collect payment for an outstanding](#collect-payment-for-outstanding-balance) balance using the [ordersCollectPaymentCreate](/docs/api/admin/reference/?v=2024-04-01#/operations/ordersCollectPaymentCreate) endpoint.
67
+
68
+
69
+
#### Update Existing Line Item
70
+
71
+
Below is an example API call to change the quantity of a line item to 1. If the existing quantity was 2, this would remove 1 quantity, can also be used to increase line item quantity. This endpoint only accepts quantity changes, to change the product or price, see [ordersLinesCreate](/docs/api/admin/reference/?v=2024-04-01#/operations/ordersLinesCreate) endpoint.
Below is an example DELETE request to the [ordersLinesDestroy](/docs/api/admin/reference/?v=2024-04-01#/operations/ordersLinesDestroy) endpoint to remove a line item.
Line items have `editable_quantity` which represents the item quantity not already in process of being fulfilled, already fulfilled, or already removed from the order.
95
+
96
+
**If `editable_quantity` is `0`, the line item cannot be edited.**
97
+
:::
98
+
99
+
100
+
#### Create New Line Item
101
+
102
+
Below is an example POST request to the [ordersLinesCreate](/docs/api/admin/reference/?v=2024-04-01#/operations/ordersLinesCreate) endpoint to create a new line item.
103
+
104
+
```json title="Create New Line Item"
105
+
// POST https://{store}.29next.store/api/admin/orders/{number}/lines/
Orders can have an outstanding balance owed by the customer as a result of changing items on the order. To collect the outstanding balance, use the [ordersCollectPaymentCreate](/docs/api/admin/reference/?v=2024-04-01#/operations/ordersCollectPaymentCreate) endpoint to initate a payment transaction with the order's initial payment method.
119
+
120
+
```json title="Collect Payment for Outstanding Balance"
121
+
// POST https://{store}.29next.store/api/admin/orders/{number}/collect-payment/
"send_payment_notification": true// optionally send notificaiton to customer
126
+
}
127
+
```
128
+
129
+
:::
14
130
15
131
### Order Refunds
16
132
@@ -152,104 +268,6 @@ Depending on the product type and status of the line items being refunded, there
152
268
- If fulfilled, restock_type must be `no_restock`.
153
269
:::
154
270
155
-
### Order Items Editing
156
-
157
-
Editing items on an order is common practice, such as swapping products purchased for a different size or color with the same value without needing to collect payment or create a refund.
158
-
159
-
:::info Only Available on 2024-04-01 API Version
160
-
Order editing APIs are only available on 2024-04-01 API Version and above, if you are still using older versions we recommend you upgrade your integration.
161
-
162
-
Order editing APIs also do not affect order payment within each request. To remove items with an associated refund, see [order refunds](#order-refunds). Using order edit APIs can result in the customer owing or the merchant owing to the customer.
163
-
:::
164
-
165
-
#### Line Item Quantities Explained
166
-
167
-
Order line items have 4 quantity attributes that represent quantities at different states in an order life cycle.
168
-
169
-
-`quantity` - Item quantity total ever added to the order in this line.
170
-
-`current_quantity` - Current item quantity that have not yet been removed.
171
-
-`fulfillable_quantity` - Item quantity that have not yet been fulfilled, such as a partial fulfillment.
172
-
-`editable_quantity` - Item quantity that currently can be edited.
173
-
174
-
```json title="Line Item Quantities Explained"
175
-
"lines": [
176
-
{
177
-
...
178
-
"quantity": 3, // quantity of items ever added
179
-
"current_quantity": 2, // current quantity that have not been removed
180
-
"fulfillable_quantity": 1, // quantity that have not yet been fulfilled
181
-
"editable_quantity": 1, // quantity that can be edited
182
-
...
183
-
}
184
-
]
185
-
```
186
-
187
-
#### Swap Items Flow
188
-
189
-
```mermaid
190
-
stateDiagram-v2
191
-
direction LR
192
-
lines: Retrieve Order Lines
193
-
removeLine: Remove Unwanted Items
194
-
addLine: Add Line Item
195
-
lines --> removeLine
196
-
removeLine --> addLine
197
-
```
198
-
199
-
Swapping Items on an order is a 3-step process:
200
-
1. Retrieve order line items using the [ordersRetrieve](/docs/api/admin/reference/?v=2024-04-01#/operations/ordersRetrieve) endpoint to obtain line items and check `editable_quantity` is > 0.
201
-
2. Update/Remove line items using the [ordersLinesPartialUpdate](/docs/api/admin/reference/?v=2024-04-01#/operations/ordersLinesPartialUpdate) or [ordersLinesDestroy](/docs/api/admin/reference/?v=2024-04-01#/operations/ordersLinesDestroy) endpoint.
202
-
3. Create new line item [ordersLinesCreate](/docs/api/admin/reference/?v=2024-04-01#/operations/ordersLinesCreate) endpoint.
203
-
204
-
205
-
#### Update Existing Line Item
206
-
207
-
Below is an example API call to change the quantity of a line item to 1. If the existing quantity was 2, this would remove 1 quantity, can also be used to increase line item quantity. This endpoint only accepts quantity changes, to change the product or price, see [ordersLinesCreate](/docs/api/admin/reference/?v=2024-04-01#/operations/ordersLinesCreate) endpoint.
Below is an example DELETE request to the [ordersLinesDestroy](/docs/api/admin/reference/?v=2024-04-01#/operations/ordersLinesDestroy) endpoint to remove a line item.
Line items have `editable_quantity` which represents the item quantity not already in process of being fulfilled, already fulfilled, or already removed from the order.
231
-
232
-
**If `editable_quantity` is `0`, the line item cannot be edited.**
233
-
:::
234
-
235
-
236
-
#### Create New Line Item
237
-
238
-
Below is an example POST request to the [ordersLinesCreate](/docs/api/admin/reference/?v=2024-04-01#/operations/ordersLinesCreate) endpoint to create a new line item.
239
-
240
-
```json title="Create New Line Item"
241
-
// POST https://{store}.29next.store/api/admin/orders/{number}/lines/
Updating an order shipping address is a common task that can be done with a PATCH request to the [ordersUpdate](/docs/api/admin/reference/#/operations/ordersUpdate) endpoint.
@@ -347,12 +365,7 @@ stateDiagram-v2
347
365
348
366
### Move Fulfillment Orders
349
367
350
-
```mdx-code-block
351
-
352
-
import MoveFulfillmentOrders from '@site/_snippets/_moving-fulfillment-orders.mdx';
0 commit comments