Is there a variable for the invoice date (invoice created on...) in Magento 2? I would like to add this to the standard template for invoice pdfs.
Thanks in advance!
Magento Stack Exchange is a question and answer site for users of the Magento e-Commerce platform. It only takes a minute to sign up.
Sign up to join this communityyes there is. Similar to order the invoices get a timestamp "created_at".
protected $order;
public function __construct(
.....
\Magento\Sales\Model\OrderFactory $order,
.......
) {
...
$this->order = $order;
........
parent::__construct($context, $data);
}
public function getInvoiceDetails($order_id){
$orderdetails = $this->order->loadByIncrementId($order_id);
foreach ($orderdetails->getInvoiceCollection() as $invoice)
{
$invoiceCreatedAt = $invoice->getCreatedAt();
}
}