Custom Fields dont show on invoice PDF

I’ve created custom fields in the invoice properties. However, these fields are included when I create the invoice. However, when I save the invoice and view it as a PDF, I don’t see the custom fields on the invoice.

Attached is a screenshot of the fields I’d like to see on the invoice.

Can someone please help me with this? I’m not very good at coding.



The custom_fields are available:

$custom_fields = [
        'invoice' => $CI->mdl_custom_fields->get_values_for_fields('mdl_invoice_custom', $invoice->invoice_id),
        'client'  => $CI->mdl_custom_fields->get_values_for_fields('mdl_client_custom', $invoice->client_id),
        'user'    => $CI->mdl_custom_fields->get_values_for_fields('mdl_user_custom', $invoice->user_id),
    ];

And also in your invoice template:

$data = [
        'custom_fields'       => $custom_fields,

Which means that where you’ve put “input_line” on your invoice template you can use that “custom_fields”

You’ll have to keep trying with using print_r($custom_fields) and see what comes in your PDF.

I usually use:

print_r($custom_fields);
die();

To stop the script from executing so you can see what’s in that variable