Blog

Introduction to Custom Fields

Posted by:

You are here:
< Back

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 =).

 

 

 

4
  Related Posts
  • No related posts found.

Comments

  1. Yuvraj Arya  February 1, 2018

    We want to show product wise Tax i.e.
    Product Name | Product Price | Taxes | Qty | Total Price

    Please let us know, how this can be done

    Yuvraj

    reply
    • Edgar Rojas  February 22, 2018

      Hello!

      Sorry for the delay (i didn’t got notified about the comment =S). Do you still need this?

      reply
  2. Marian Waginger  May 29, 2019

    Hello,
    I downloaded your plugin and it is great, I would like to add some custom fiels, but I dont see it in a menu as on your screenshot. If I create the custom field in WP manually I dont see it in your editor under, “custom field icon”.
    Can you please explain how it works? I have latest WP version.

    reply
    • Edgar Rojas  May 29, 2019

      Hello!

      Sorry for the confusion, the custom fields are only available in the full version.

      reply

Add a Comment