I am using the Commerce 2 plugin and I am experiencing a very odd issue. Once an order is complete I want to use the dateOrdered property to create a csv which I send through a request endpoint. That worked fine.
BUT! Since recently (somewhere this month), on the first attempt to create and save the .csv, when calling $order->dateOrdered->getTimestamp()
I get dateOrdered
as a string
.
On the second attempt to create and save the .csv I get dateOrdered
as a DateTime
.
The method which I am calling is the same so I think it has something to do wiht order statuses.
I tried to trace the problem in Commerce's Order.php
class but I still have no clue why this occurs or what I am doing wrong.
Any help is more than welcome. Thank you in advance!