@spree/docs 0.1.247 → 0.1.248
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -242,6 +242,25 @@ Two details worth knowing:
|
|
|
242
242
|
- **Delivery and order-level fees are shared out by item value**, so a seller whose goods made up most of the basket carries most of the delivery charge.
|
|
243
243
|
|
|
244
244
|
> **WARNING:** A storefront must handle the possibility of an order group. Completing a cart may yield one order or several, and a customer's order history should show the group as one purchase rather than confronting them with three orders they don't remember placing separately.
|
|
245
|
+
>
|
|
246
|
+
> A back office must handle it too: an order raised from the admin divides the same way, so completing one may answer with a group instead of an order.
|
|
247
|
+
|
|
248
|
+
|
|
249
|
+
```typescript Admin SDK
|
|
250
|
+
import { isOrderGroup } from '@spree/admin-sdk'
|
|
251
|
+
|
|
252
|
+
const result = await client.orders.complete('or_UkLWZg9DAJ')
|
|
253
|
+
|
|
254
|
+
// One order per seller when the order held several sellers' goods.
|
|
255
|
+
const orders = isOrderGroup(result) ? result.orders : [result]
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
```bash cURL
|
|
259
|
+
curl -X PATCH https://your-store.com/api/v3/admin/orders/or_UkLWZg9DAJ/complete \
|
|
260
|
+
-H "X-Spree-API-Key: sk_xxx" \
|
|
261
|
+
-H "Content-Type: application/json"
|
|
262
|
+
```
|
|
263
|
+
|
|
245
264
|
|
|
246
265
|
## Commission
|
|
247
266
|
|