Development

Coding skills (HTML, CSS, PHP) required for this section.

Make Custom template

You can make custom template and load it from anywhere (Theme, Plugin). First look at our default simple template.

It's located at \pdf-invoices-and-packing-slips\templates\simple.

Simple template code

Under simple folder, you'll see two folders (invoice & packing). It's fine to make template for only invoice OR packing-slips.

Example folder structure for invoice template:

\custom-template-name\invoice

Inside invoice folder, You must have one required file called template.php

Then you need to register custom template :

// For "invoice"
add_filter('pips_packing_templates', 'register_invoice_templates');

function register_invoice_templates($invoice_templates) {
   $invoice_templates['custom-template-name'] = __('Custom Template', 'text-domain');

   return $invoice_templates;
}


// For "packing-slips"
add_filter('pips_packing_templates', 'register_packing_templates');

function register_packing_templates($packing_templates) {
   $packing_templates['custom-template-name'] = __('Custom Template', 'text-domain');

   return $packing_templates;
}

Locate your custom template :


// For "invoice"
add_filter('pips_invoice_template_locate', 'update_invoice_template_path', 10, 2);

function update_invoice_template_path($path, $invoice_template) {
   if ($invoice_template === "custom-template-name") {
      return dirname(__FILE__) . '/templates/' . $invoice_template . '/invoice';
   }

   return $path;
}


// For "Packing-slips"
add_filter('pips_packing_template_locate', 'update_packing_template_path', 10, 2);

function update_packing_template_path($path, $packing_template) {
   if ($packing_template === "custom-template-name") {
      return dirname(__FILE__) . '/templates/' . $packing_template . '/packing';
   }

   return $path;
}

Now go on Template settings, You'll seen custom template as option.

Available Hooks

Filter invoice customer billing details

apply_filters('pips_get_customer_details', 'N/A', $order);

Filter invoice customer shipping details

apply_filters('pips_get_shipping_details', 'N/A', $order);

Filter invoice date

apply_filters("pips_filter_invoice_date", $default_date, $order_id);

Register custom column for invoice product table

apply_filters('pips_invoice_product_columns', $columns, $order);

Used for display content in specific column

do_action('pips_product_column_{column_key}', $order_item, $order);

Register custom invoice templates

apply_filters('pips_invoice_templates', $templates);

Register custom packing slip templates

apply_filters('pips_packing_templates', $templates);

Filter invoice template path

apply_filters('pips_invoice_template_locate', $path, $template);

Filter packing slips template path

apply_filters('pips_packing_template_locate', $path, $template);