Creating a custom sub-total

Posted by:

You can also add a custom row in the subtotal area, this custom row could either display a text or do a custom calculation

To create a custom sub total do the following:

1.- Go to custom fields and create a new custom field:

2.- Create the custom field either using the custom field wizard or returning any value, the custom code below will just create a custom subtotal with the text ‘This is a custom row’.

Important: If you want to add this custom field in the subtotal area you need to select ‘Subtotal Row’ in the type of custom field

3.- Go to your pdf template and in the ‘invoice detail’ settings go to the ‘Subtotals’ section and click on Add custom subtotal

4.- Select the custom field that you created and click on ‘Add’

5.- Optional: Define a label for your custom row

And that’s it! With these changes your custom subtotal will be added to your table

0

Displaying the product extra options

Posted by:

Note: A full version is required to use these features

There are two ways to display the product meta

1.- Via invoice detail settings

If you have a recent version of the plugin you can just enable it via the “Invoice Detail” table settings

2.- Via custom fields

To create a custom field that displays the product name and all the selected options do the following:

1.- Go to WC Invoice/Custom fields and create a new custom fields.

2.- Create a custom field with this information:

Name: Whatever you want it to be named

Type: Table Column field (because this custom field is going to be added to your invoice table).

Code: 


return (new CArrayField("table","meta",""))->GetFormattedMetaData();

Your custom field should looks like this:

3.- Add your new custom field to your invoice table

And that’s it! Now your invoice will show all the custom fields it has:

0

Integrating the PDF Builder with other Woocommerce plugins

Posted by:

Do you have another plugin that saves more information and want to display it in a PDF (like woocommerce booking or “Product Add-Ons”? Then you can use the custom field wizard to add this information in your pdf in seconds. All you need to do is this:

1.- Go to ‘Custom Fields’

2.- Click in ‘Open Custom Field Wizard’

3.- Select an order (using the order id)that has the information that you want to display. Then the plugin will inspect that order and will show you all the information that woocommerce is saving about that order, you just need to select the type of information that you want to display

How can you find the order number?

Generally, you can find the order number in the top section of the “Order” page

But there are some plugins that could modify this number and display a formatted version. If that is the case for you, you can still find the order number in the “Order” URL

4.- Once you select the fields that you want to display you can also format them as a number, currency, date or even QRCode!

And thats it, now all you need to do is save and add your new field in your pdf template.

0

Adding your orders custom fields in an invoice

Posted by:

There are many plugins that add additional information to the orders, typically this information is stored in the Order ‘Custom Fields’ section

In this example i have the custom fields ‘Color’ and ‘Gift Message’.

 

If you want to add this information in your invoice all you need to do is the following:

1.Create a new custom field

2.- And add the following  text:

return get_post_meta($order->id,’Custom_Field_Name’,true);

like this:

In this example i am getting the custom field ‘Color’ from my order.

 

3.- Add your new custom field in your invoice

That’s it =).

2

Adding QRCodes to the order detail table

Posted by:

In a previous article i explained how to add QRCodes to apdf. This time i am going to explain how to do the same inside the invoice detail table, so you could create a QRCode for the product sku, order price, weight or basically any information of your products.

Getting Started

The process is pretty straight forward, all you need to do is this:

1.- Create a Custom Field

2.- Define which information you want to convert to QRCode, in this example i am going to convert the SKU of the product into a QRCode. To get the sku of the product i need this piece of code :

item[‘sku’]

Note: I could use the same piece of code to get other information like:

  • name:Product Name
  • qty:Quantity
  • weight:Weight
  • line_subtotal:Price of the product without taxes
  • line_total: Price of the product with taxes
  • line_tax: Tax of the product

3.- Generate a QRCode with the information that i defined in my previous step like this:

4.- Use my new Custom Field in my table like this:

 

Thats it! If you have any question please let me know!

 

0

Introduction to Custom Fields

Posted by:

The invoice builder already comes bundled with a bunch of fields that you can pick from but you can create your own if those fields are not enough. If you want to create something more advance like a table that display your customer order history or a field that gets the order date and add two days to it (maybe you want to use that as the ‘shipping date’?) you need to use custom fields. In this tutorial i am going to show you how to do a very basic custom field which will show the current logged in user name in the invoice. In future tutorials i am going to show you how to do more advanced fields. So lets start =).

Creating or Editing a Custom Field

Important: The custom fields are a very powerful feature that let you do almost anything like contacting other servers or querying your site’s database so only admins are alowed to edit or create them.

1.- Open the custom fields builder:

 

2.- Select the custom field that you want to edit or create a new one.

The Custom Field Designer

The custom field designer consist of two main parts:

Name: The name of your custom field, this name is going to be used in the invoice designer.

Code: Here you can put the code of your custom field, this code has to be done using PHP and every sentence must end with a semi colon.

In the screenshot above i am getting the user data using wp_get_current_user() and then i am getting the user name using ->user_login, again, this need to be done with PHP.

 

Using a custom field in an invoice

Now that you have your custom field all you need to do is drop a ‘Custom Field’ item in your invoice

 

Then just click in the new item and select the custom field that you want to use =)

 

 

But what can i do if i don’t know PHP

Well, first of all i will be posting more useful snipets so keep checking this site, you might find the sniped that you need or if you don’t find it let me know =).

 

 

 

6