Remove sku column from Magento 2 invoice and pdf

Edit the file
/vendor/magento/module-sales/Model/Order/Pdf/Items/Invoice/DefaultInvoice.php

Inside function draw(), remove/comment following code:

   // draw SKU
        $lines[0][] = [
            'text' => $this->string->split($this->getSku($item), 17),
            'feed' => 290,
            'align' => 'right',
        ];

To remove the SKU header in table header, edit the file
/vendor/magento/module-sales/Model/Order/Pdf/Invoice.php

//$lines[0][] = ['text' => __('SKU'), 'feed' => 290, 'align' => 'right'];

and copy the file vendor/magento/module-sales/view/frontend/templates/email/items/order/default.phtml
to app/design/your/theme/Magento_Sales/templates/email/items/order/default.phtml
and remove the code

<p class="sku"><?= /* @escapeNotVerified */  __('SKU') ?>: <?= $block->escapeHtml($block->getSku($_item)) ?></p>

Posted

in

,

by

Comments

2 responses to “Remove sku column from Magento 2 invoice and pdf”

  1. shafeel sha Avatar
    shafeel sha

    Hi, Harshvardhan Malpani
    could you please explain what is “feed ” mean by below query ,its instead of width ? also any rules declaring feed ?

    // draw SKU
    $lines[0][] = [
    ‘text’ => $this->string->split($this->getSku($item), 17),
    ‘feed’ => 290,
    ‘align’ => ‘right’,
    ];

    1. Harshvardhan Malpani Avatar

      As per official documentation, feed is an integer used for “x” (horizontal) position
      https://github.com/magento/magento2/blob/2.3-develop/app/code/Magento/Sales/Model/Order/Pdf/AbstractPdf.php#L963

      See more examples of “feed” usage here

Leave a Reply

Your email address will not be published. Required fields are marked *