Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(php-sdk): add documentation for order notes #78

Merged
merged 4 commits into from
Aug 31, 2023
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions src/documentation/50.php-sdk.md
Original file line number Diff line number Diff line change
Expand Up @@ -643,6 +643,40 @@ $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
Mark-Ernst marked this conversation as resolved.
Show resolved Hide resolved
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