I don't want to display the credit card details on invoice PDF.

How can I achieve this programmatically? In which file should I do the modification?

Pleaseenter image description here check the attached image

2 Answers 2


You can do it by pluginize or Overwrite.


Change the template and modify there which field you want to hide.

 * Render as PDF
 * @return string
public function toPdf()
    return $this->toHtml();

This is not tested code.


I have found the answer of above question

Need to change the $payment variable output in below file:


1) just debug the $payment variable and check the output... line # 434

2) then when you draw the output then check for the foreach output. line #530

you can exclude the details of credit card by modifying the code from above two sections mentioned lines

  • but modify the code in core file is not a good idea. Feb 25, 2020 at 7:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.