Skip to content

Commit

Permalink
docs(php-sdk): add documentation for order notes (#78)
Browse files Browse the repository at this point in the history
* feat(sdk): add documentation for order notes

* feat(sdk): add documentation for order notes

* refactor: line length

* fix: feedback
  • Loading branch information
Mark-Ernst authored Aug 31, 2023
1 parent 460013e commit 12c65bb
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions src/documentation/50.php-sdk.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 12c65bb

Please sign in to comment.