Jump to content

how to change invoice item description


Recommended Posts

  • 11 months later...
Similar issue for me, too.


I would like to change

Domain Renewal - mydomain.gr - 1 Year (14/04/2015 - 13/04/2016)


Domain Renewal - mydomain.gr - annualy


Any ideas?


do you offer more than one year for domain registration like

Domain Renewal - mydomain.gr - 3 Years (14/04/2015 - 13/04/2018)

Link to comment
Share on other sites

Do you understand how hooks work? This hook will provide the invoice id which can be used to look up the invoice items. If your purpose is to modify a invoice line description before the invoice is sent to customer then this is the hook to use.

Link to comment
Share on other sites

Yes, this hook will be executed after invoice generation but before the email gets sent to the client. The hook function you would create should look up the invoice line items in the database and update them as needed.


So in includes/hooks/hooks.php you could have:


if (!defined("WHMCS"))
   die("This file cannot be accessed directly");

add_hook("InvoiceCreationPreEmail", 1, "hook_invoice_line_edit");

function hook_invoice_line_edit($vars)
   //vars from hook
   $souce = $vars['source'];
   $user = $vars['user'];
   $invoiceid = $vars['invoiceid'];

   //get invoice line items from DB
   $table = 'tblinvoiceitems';
   $fields = 'id, type, description';
   $where = array('id' => $invoiceid);
   $result = select_query($table, $fields, $where);
   //loop through line items to find ones for domains
   while ($line = mysql_fetch_assoc($result))
       $id = $line['id'];
       $type = $line['type'];
       $description = $line['description'];
       if ($type == 'Domain')
           //set new description and then update tblinvoiceitems


Code above is not tested but should get you started.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated