I'm trying to get order purchase point (store where it was purchased), I have tried this:
$order->getPurchasePoint();
It did not work, any ideas?
here is my code
public function execute()
{
$date = date('m-d-Y');
$filepath = 'export/orders-'.$date.'.csv';
$this->directory->create('export');
$stream = $this->directory->openFile($filepath, 'w+');
$stream->lock();
$header = ['Id', 'Status','Store'];
$stream->writeCsv($header);
$collection = $this->getOrderCollection();
foreach ($collection as $order) {
$data = [];
$data[] = $order->getId();
$data[] = $order->getStatus();
$data[] = $order->getPurchasePoint();
$stream->writeCsv($data);
}
}
public function getOrderCollection()
{
$collection = $this->orderCollection->create()
->addAttributeToSelect('*')
->setOrder('created_at','desc');
return $collection;
}