cancel
Showing results for 
Search instead for 
Did you mean: 

remove sku from email and pdf

remove sku from email and pdf

Can any one put me in the right direction to remove sku from email and pdf?

4 REPLIES 4

Re: remove sku from email and pdf

If you want to remove from order email then go to 

 

vendor\magento\module-sales\view\frontend\templates\email\items\order

 

open default.phtml

comment below line

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

 

then flush cache and check it.

for invoice and credmit memo it is different template call.

 

After that work, you need to call that phtml file into your theme or your module.

 

for invoice

 

module-sales\Model\Order\Pdf\Items\Invoice\DefaultInvoice.php

 

in draw function

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

 

you need to comment that code.

 

If that work then you  need to override that model using di.xml

 

Hope it wiill help you.

 


Problem solved? Click Kudos & Accept as Solution!
Sunil Patel
Magento 2 Certified Professional Developer & Frontend Developer

Re: remove sku from email and pdf

You need to edit two files:
File 1:

app/design/frontend/base/default/template/email/order/items.phtml
Find the following line and comment it:

<th align="left" bgcolor="#EAEAEA" style="font-size:13px; padding:3px 9px"><?php echo $this->__('Sku') ?></th>

-----OR-----

empty the value as:

<th align="left" bgcolor="#EAEAEA" style="font-size:13px; padding:3px 9px">&nsbp;</th>

File 2:

app/design/frontend/base/default/template/email/order/items/order/default.phtml

And comment the following line:

<td align="left" valign="top" style="font-size:11px; padding:3px 9px; border-bottom:1px dotted #CCCCCC;"><?php echo $this->escapeHtml($this->getSku($_item)) ?></td>

-----OR-----

empty the value as:

<td align="left" valign="top" style="font-size:11px; padding:3px 9px; border-bottom:1px dotted #CCCCCC;">&nbsp;</td>

Hope this helps.

Re: remove sku from email and pdf

It worked like a charm on magento 2.1.7 thank you !

 

 

Re: remove sku from email and pdf

The description above works great for simple products (items). If you need to remove the SKU for the Bundle, Downloadable, and Group items, you need to override the following classes.

  • [bundle] => Magento\Bundle\Model\Sales\Order\Pdf\Items\Invoice
  • [downloadable] => Magento\Downloadable\Model\Sales\Order\Pdf\Items\Invoice
  • [grouped] => Magento\GroupedProduct\Model\Order\Pdf\Items\Invoice\Grouped

This is because the PDF renderer checks on the product type and then pulls the corresponding model.