diff --git a/src/documentation/50.php-sdk.md b/src/documentation/50.php-sdk.md index 873da9fc..9702eaf0 100644 --- a/src/documentation/50.php-sdk.md +++ b/src/documentation/50.php-sdk.md @@ -643,6 +643,34 @@ $orderCollection->push($order); $savedOrderCollection = $orderCollection->save(); ``` +### Adding order notes to an order + +It is possible to add notes to an order. These notes are visible in the backoffice. A note can be either a customer note or a webshop note. A webshop note can be created in the admin panel of an e-commerce platform. + +To add a note to an order, simply create an `OrderNote` and add it to an `OrderNoteCollection`. Then, save the collection to our API. + +```php +use MyParcelNL\Sdk\src\Model\Fulfilment\OrderNote; +use MyParcelNL\Sdk\src\Collection\Fulfilment\OrderNoteCollection; + +$orderNoteCollection = new OrderNoteCollection(); +$orderNote = new OrderNote([ + 'orderUuid' => 'uuid_of_order', // You need the uuid generated by our API. + 'note' => 'This is a note', + 'author' => 'webshop', // This can be either 'webshop' or 'customer'. +]) + +$orderNoteCollection->push($orderNote); + +// This will send the order note to our API. Thanks to the uuid, the note will +// be placed in the correct order. +$savedOrderNoteCollection = $orderNoteCollection->save(); +``` + +::: note +Note: The uuid of an order can be found in the response of the `save` method of the `OrderCollection`. Therefore, you need to save the order first before you can add notes to it. +::: + ### Setting up webhooks You can use our webhooks to keep track of changes in shipments, labels and your