How To Remove Payment Info From Packing Slip

Personally, I think this is a bad idea, including any kind of credit card information on any kind of print information. In Magento, the credit card information is included by default on the PDF packing slip, although it is only just the last four and the expiration date. Still, too much for me. So after much searching, I came up with nothing. Then I stumbled on another post of ours here at Imagedia, that had to do with removing the shipping charges from the packing slip in Magento.

Searching through the code in that same file, we found some code that achieves what we’re looking for. As always, BACKUP YOUR FILES!

Here is the process:

  1. Go to your server and open app/code/local/Mage/Sales/Order/Pdf/Abstract.php
  2. Find this code, around line 294: foreach ($payment as $value){
    if (trim($value)!==”) {
    $page->drawText(strip_tags(trim($value)), $paymentLeft, $yPayments, ‘UTF-8′);
    $yPayments -=10;
    }
  3. Change that code to read: foreach ($payment as $value){
    if (trim($value)!==”) {
    $yPayments -=10;
    }
  4. That gets rid of the payment info.
  5. Next, remove the heading.
  6. Find this code, around 277 or so: $page->drawText(Mage::helper(’sales’)->__(’Payment Method’), 35, $this->y, ‘UTF-8′);
  7. Change it to read: $page->drawText(Mage::helper(’sales’)->__(’Shipping Method:’), 35, $this->y, ‘UTF-8′);
  8. Next line down reads: $page->drawText(Mage::helper(’sales’)->__(’Shipping Method:’), 285, $this->y , ‘UTF-8′);
  9. Delete that.
  10. Now, go down about 30 lines to find this: $page->drawText($shippingMethod, 285, $this->y, ‘UTF-8′);
  11. Change it to: $page->drawText($shippingMethod, 35, $this->y, ‘UTF-8′);
  12. Save your file.

Go to Magento Admin, go to sales, select an order, select a shipment and click “Print”. The result should be a clean packing slip with no payment information included at all, which is how it should be.

This may be a bit of a hack, but it’s the only way we could find how to remove payment and credit card information from Magento packing slips.

You must be logged in to post a comment.