Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Contributor Yordan Soares

    (@yordansoares)

    Hi @martje65,

    This can be achieved in two different ways:

    1. With a custom block, using the customizer included in Premium Templates, this way:

      A screenshot that displays a custom block with the page numbering setup

    2. With some PHP code, with a code snippet like this:
      /**
       * WooCommerce PDF Invoices & Packing Slips:
       * Add a page numbering on the invoices
       */
      add_action( 'wpo_wcpdf_after_document', function ( $document_type, $order ) {
      	if( $document_type == 'invoice' ) {
      		echo '<div style="position:fixed; left:0; bottom:-1cm; height: 1cm; width:100%">Page {{PAGE_NUM}} of {{PAGE_COUNT}}</div>';
      	}
      }, 10, 2 );

      If you haven’t worked with code snippets (actions/filters) or functions.php before, read this guide: How to use filters

    Please note that repeating the headers & footers, and adding a page numbering to your documents, doesn’t work if you also want to print the invoices in bulk from the order list, as the footers of multiple invoices will stack on top of each other. This can be solved using the Bulk export feature included in the Professional extension.

    Thread Starter martje65

    (@martje65)

    Thanks for the code snippet @yordansoares but it only shows at the last page.

    Plugin Contributor Yordan Soares

    (@yordansoares)

    You’re right @martje65, please try replacing the previous code snippet with this one:

    /**
     * WooCommerce PDF Invoices & Packing Slips:
     * Add a page numbering on the invoices
     */
    add_action( 'wpo_wcpdf_before_document', function ( $document_type, $order ) {
    	if( $document_type == 'invoice' ) {
    		echo '<div style="position:fixed; left:0; bottom:-1cm; height: 1cm; width:100%">Page {{PAGE_NUM}} of {{PAGE_COUNT}}</div>';
    	}
    }, 10, 2 );

    Let me know if it worked this time! ??

    Thread Starter martje65

    (@martje65)

    That works @yordansoares , Thanks

    Plugin Contributor Yordan Soares

    (@yordansoares)

    I’m glad to hear that, @martje65!

    If you don’t mind and have the time, do you think you could leave us a review?

    Thanks in advance and all the best with your store!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘multi page invoice’ is closed to new replies.