{"id":655,"date":"2019-10-30T05:05:35","date_gmt":"2019-10-30T05:05:35","guid":{"rendered":"https:\/\/meetanshi.com\/blog\/2019\/10\/30\/remove-sku-column-from-magento-2-invoice-pdf\/"},"modified":"2025-05-22T15:29:37","modified_gmt":"2025-05-22T09:59:37","slug":"remove-sku-column-from-magento-2-invoice-pdf","status":"publish","type":"post","link":"https:\/\/meetanshi.com\/blog\/remove-sku-column-from-magento-2-invoice-pdf\/","title":{"rendered":"Actionable Steps to Remove SKU Column From Magento 2 Invoice PDF"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Earlier I posted the solution to <a href=\"https:\/\/meetanshi.com\/blog\/remove-sku-from-product-page-in-magento-2\/\" target=\"_blank\" rel=\"noreferrer noopener\">remove SKU from product page in Magento 2<\/a>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">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!<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">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!<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">But we know that customers can live without knowing the SKU of the products they purchased  <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Hence, we\u2019ll remove SKU column from<em><strong> <\/strong><\/em>Magento 2 invoice pdf! And that too programmatically so as to quickly finish this task!<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Method to remove SKU column from Magento 2 Invoice PDF:<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Visit&nbsp;<a href=\"https:\/\/meetanshi.com\/blog\/override-magento-2-invoice-pdf\/\">How to Override a Method of Abstract File of Magento 2 Invoice PDF<\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Remove the below lines from this solution\u2019s override class&nbsp;<strong>MagentoSalesModelOrderPdfInvoice<\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">$lines[0][] = ['text' => __('SKU'), 'feed' => 290, 'align' => 'right'];<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">and also remove following code from&nbsp;<strong>MagentoSalesModelOrderPdfItemsInvoiceDefaultInvoice<\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">$lines[0][] = [\n           \/\/ phpcs:ignore Magento2.Functions.DiscouragedFunction\n           'text' => $this->string->split(html_entity_decode($this->getSku($item)), 17),\n           'feed' => 290,\n           'align' => 'right',\n       ];<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">For downloadable product, go to <strong>MagentoDownloadableModelSalesOrderPdfItemsInvoice<\/strong> and comment or remove the below code:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ draw SKU\n    $lines[0][] = [\n        'text' => $this->string->split($this->getSku($item), 17),\n        'feed' => 290,\n        'align' => 'right',\n    ];<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">For bundled product, go to <strong>MagentoBundleModelSalesOrderPdfItemsInvoice.php<\/strong> and comment or remove the below code:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\"> \/\/ draw SKUs\n        \n        if (!$childItem->getOrderItem()->getParentItem()) {\n                $text = [];\n                foreach ($this->string->split($item->getSku(), 17) as $part) {\n                    $text[] = $part;\n                }\n                $line[] = ['text' => $text, 'feed' => 255];\n            }<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Adjust the blank space in the PDF by pixels arrangement.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">However, if you do not want to make any changes in the default file, you can override it by installing <a href=\"https:\/\/github.com\/MeetanshiInc\/Remove-SKU-Column-From-Magento-2-Invoice-PDF\" target=\"_blank\" rel=\"noreferrer noopener\">this extension<\/a>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">That\u2019s it.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Making customers\u2019 life easier is our job and the post helps for the same!<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I\u2019d be grateful if you take time out to share the solution with fellow developers via social media.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Thanks.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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 [&hellip;]<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[34],"tags":[],"class_list":["post-655","post","type-post","status-publish","format-standard","hentry","category-magento"],"_links":{"self":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/655","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/comments?post=655"}],"version-history":[{"count":3,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/655\/revisions"}],"predecessor-version":[{"id":15204,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/655\/revisions\/15204"}],"wp:attachment":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/media?parent=655"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/categories?post=655"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/tags?post=655"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}