Earlier I posted the solution to remove SKU from product page in Magento 2.
And we know that SKUs are something that the customers need not handle. The customers want to enjoy the shopping and leave handling the technical aspects on the developers!
However, SKUs are important in Magento 2 for unique identification of the products and hence it has a place in the product page, invoice and invoice pdf!
But we know that customers can live without knowing the SKU of the products they purchased 😛
Hence, we’ll remove SKU column from Magento 2 invoice and pdf! And that too programmatically so as to quickly finish this task!
Method to remove SKU column from Magento 2 Invoice and PDF:
Remove the below lines from this solution’s override class Magento\Sales\Model\Order\Pdf\Invoice
$lines = ['text' => __('SKU'), 'feed' => 290, 'align' => 'right'];
and also remove following code from Magento\Sales\Model\Order\Pdf\Items\Invoice\DefaultInvoice
$lines = [
// phpcs:ignore Magento2.Functions.DiscouragedFunction
'text' => $this->string->split(html_entity_decode($this->getSku($item)), 17),
'feed' => 290,
'align' => 'right',
Adjust the blank space in the PDF by pixels arrangement.
Making customers’ life easier is our job and the post helps for the same!
And my task is to solve the readers’ doubts. So please mention them, if any, in the Comments section below and I’d be there for you 🙂
I’d be grateful if you take time out to share the solution with fellow developers via social media.