Skip to content

Commit

Permalink
feat(sdk): add documentation for order notes
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark-Ernst committed Aug 30, 2023
1 parent 460013e commit 682eb4f
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions src/documentation/50.php-sdk.md
Original file line number Diff line number Diff line change
Expand Up @@ -643,6 +643,41 @@ $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 customer note is
always created in the checkout process and 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
Expand Down

0 comments on commit 682eb4f

Please sign in to comment.