I've manage to add custom attribute warehouse_location
to Print on PDF
an bellow are the class to overwrite :
/vendor/magento/module-sales/Model/Order/Pdf/Items/Invoice/DefaultInvoice.php
update draw()
Method in my case:
// draw Warehouse Location
$lines[0][] = [
'text' => $this->getWarehouseLocation($item),
'feed' => 240,
'align' => 'right',
];
/vendor/magento/module-sales/Model/Order/Pdf/Items/Shipment/DefaultShipment.php
update draw()
Method in my case:
// draw Warehouse Location
$lines[0][] = [
'text' => $this->getWarehouseLocation($item),//This you will have to build
to get custom attribute mime case:
$this->loadMyProduct($item->getSku())->getCustomAttribute('warehouse_location')->getValue()
'feed' => 240,
'align' => 'right',
];
/vendor/magento/module-sales/Model/Order/Pdf/Items/AbstractItems.php
All of the above class are to overwrite method to PDF draw()
And the Bellow are to overwrite method to PDF _drawHeader()
update _drawHeader()
Method both files:
$lines[0][] = ['text' => __('Warehouse Location'), 'feed' => 260]
/vendor/magento/module-sales/Model/Order/Pdf/Shipment.php
/vendor/magento/module-sales/Model/Order/Pdf/Invoice.php
Hope it helps anyone!