Magento: Add custom text at the bottom of invoice pdf

Magento: Add custom text at the bottom of invoice pdf

July 17, 2026 · Illustrated author avatarBy Stefan Bogdanescu
Magento: Add custom text at the bottom of invoice pdf

Adding Custom Text to Magento Invoice PDF

Welcome to our guide on adding custom text to your Magento invoice PDFs! As a new developer, you may be looking for ways to personalize your invoices with terms and conditions or additional information.

Understanding the Invoice Process

Before we dive into the solution, let’s briefly understand how Magento generates PDF invoices. When an order is marked as invoiced in the backend, Magento uses the Mage_Sales_Model_Order_PdfInvoice model to generate a new PDF file containing invoice details.

Overriding the Default Invoice Template

To add custom text at the bottom of your invoices, you’ll need to override the default PDF invoice layout. Here’s how:

  1. Create a Custom Layout File

    Navigate to app/design/frontend/{your_package}/{your_theme}/layout/ and create a new XML file named sales.xml.

    <layout version="0.1.0">
      <!-- Override the default invoice layout -->
      <update handle="invoice_pdf_items_order"/>
    </layout>
    
  2. Add Custom Text

    In your theme’s template directory, create a new folder named template if it doesn’t exist. Inside this folder, make another folder called sales. Finally, inside the sales folder, create an XML file named order_invoice_pdf_items.xml.

    <layout version="0.1.0">
      <!-- Define your custom text -->
      <block type="core/text" name="additional.information" template="sales/items.phtml"/>
    </layout>
    
  3. Define the Custom Text

    In app/design/frontend/{your_package}/{your_theme}/template/sales/, create a new PHP file named items.phtml.

    <?php echo $this->getLayout()->createBlock('core/text')->setText('<p>This is your custom text at the bottom of the invoice.</p>'); ?>
    
  4. Update the Layout XML File

    Open your sales.xml file from step 1 and update it as follows:

    <layout version="0.1.0">
      <!-- Override the default invoice layout -->
      <update handle="invoice_pdf_items_order"/>
      <reference name="root">
        <action method="setTemplate" ifconfig="design/package/name" template="page/html/pager.phtml"/>
      </reference>
    </layout>
    

Testing Your Changes

After making these changes, you’ll need to refresh your cache using the Magento admin panel (System > Cache Management) or by running php bin/magento cache:flush in your terminal if you’re on a recent version.

To test your custom invoice layout:

  1. Create a new order and mark it as invoiced.
  2. Click ‘PDF Invoice’ to generate the PDF file.
  3. Open the generated PDF to see your custom text at the bottom of the invoice!

Conclusion

Adding custom text to Magento’s invoice PDFs requires some knowledge of theme development and layout management. By following this guide, you should now be able to add terms and conditions or any other necessary information to the footer of your invoices.

Remember, when working with Magento themes, it’s always a good practice to create child themes for your modifications. This ensures that your changes are preserved even if you update your parent theme in the future.

If you found this guide helpful, feel free to explore more of our Magento tutorials at Laravel Company. Happy coding!

Themes Admin Orders

Our network