Craft Commerce 2 - get order data for plugin I want to write a plugin which writes all the order data into a CSV file.
Unfortunately the documentation for Commerce 2 isn't quite complete yet so I have difficulties to find out how to do the following with a plugin (so I need to use PHP and not Twig).


Get an order by ID.
Get ordered items.
Get the addresses for the order.


Every help appreciated.
$order = \craft\commerce\elements\Order::find()-&gt;id($id)-&gt;one();

if($order)
{
  foreach ($order-&gt;getLineItems() as $item) {
   // $item-&gt;description
   // $item-&gt;qty
  }

  $billingAddress = $order-&gt;getBillingAddress();
  $shippingAddress = $order-&gt;getShippingAddress();
}