Customizing Invoices

WP Ultimo offers the option to send PDF invoices after a payment is received (and in some cases, like the Manual Gateway, when a pending payment is created). It might be useful and/or necessary to add extra information on that invoice, like a legal notice, and to be able to make changes to the From and To fields of the invoice.

Modifying the From and To fields

Each invoice has two separated columns to contain information from your company and the client. WP Ultimo exposes two different hooks to allow you to customize what information gets displayed on those columns: wu_invoice_from and wu_invoice_to.

Adding information to the bottom of the Invoice

To add information to the bottom of the invoice you can make use of the filter wu_invoice_bottom_message. There are two ways of displaying information: if you return an array with ‘title’ and ‘message’, both elements will be displayed; if a string is returned, only the message will be displayed.

 


Was this article helpful?

Related Articles

5 Comments

  1. nicod

    Is client id must be find with a custom function for modifying the “TO” field or is client id is a “wpultimo variable”?
    ex:
    add_filter(‘wu_invoice_to’, ‘nw_adresse_toPdf’);
    function nw_adresse_toPdf($client_id){
    $nom=get_user_meta($client_id,’wpultimo_invoice_nom’,true);
    $prenom=get_user_meta($client_id,’wpultimo_invoice_prenom’,true);
    $adresse=get_user_meta($client_id,’wpultimo_invoice_adresse’,true);
    $cp=get_user_meta($client_id,’wpultimo_invoice_cp’,true);
    $ville=get_user_meta($client_id,’wpultimo_invoice_ville’,true);
    $pays=get_user_meta($client_id,’wpultimo_invoice_pays’,true);

    return array(
    $nom.’ ‘.$prenom,
    $adresse,
    $cp.’ ‘.$ville,
    $pays
    );
    }

    1. Arindo Duque

      $client_id id the WordPress user id associated with the owner of that invoice. You can use get_user_meta normally with it. Your example code should work perfectly. Is it working?

      1. nicod

        No it doesn’t work (I need to “manually” set client id ) to get it works ex:
        add_filter(‘wu_invoice_to’, ‘nw_adresse_toPdf’);
        function nw_adresse_toPdf($client_id){
        $client_id=25…..
        );
        }
        I put my function in mu-plugin folder

        1. Arindo Duque

          You are right, Nicod. That was my mistake in the documentation. The first parameter passed to the callback function is the $lines array containing the lines currently on the invoice. User_id is passed as a second variable, I’m sorry.

          https://docs.wpultimo.com/knowledge-base/customizing-invoices/?rcc

          I’ve updated the docs, let me know if that clarifies things.
          PS.: When updating your code, remember that the callback is taking two parameters now, so your function call should be add_filter(‘wu_invoice_to’, ‘nw_adresse_toPdf’, 10, 2);

          1. nicod

            No problem: it’s works thanks !

Leave A Comment?