How can we improve WHMCS?

Share, discuss and vote for what you would like to see added to WHMCS

Remove addons displayed on Invoice when not purchased

  • VCCS Telecom shared this idea 11 years ago
  • Payments/Billing
  • 13 Comments


Currently add-ons are shown on every invoice for the product associated even if they are not purchased. Agreed they should be available as an upgrade on the back-end but with many options the invoice is cluttered with confusing garbage.

14 Comments

Login to post a comment.

This is a very important feature, it should be options like custom fields.
Hard to imagine this isn't a standard option. Would be great to see it in WHMCS so we don't have to hack the code in ourselves.
Any update on this?

I figure "don't show the thing the customer didn't want" was a fairly obvious feature requirement, haha
Yes, yes from me. I can't believe this issue has been outstanding for so long.

It looks REALLY unprofessional with these add ons on the invoice. Not a good look at all.

Surely something like the custom field options where you can choose where it shows up would be pretty straightforward?
Yes yes yes! This needs to be implemented as soon as possible. Invoices look terrible with line after line of items that weren't ordered. Please add this ASAP!
This is needed, Many clients get frustrated to see all options they don't buy on the invoice.

It looks cheap and unprofessional.

I tried the fixes above on WHMCS 7.6.1 but it looks like it's not working any more.
Is there any way this can be implemented in the confirmation email? I was able to use the code above succesfully to filter the client area and the PDF but no love on the email body.

Placeholder is {$invoice_html_contents}

Can a similar regex be implemented in the email body?
this really needs to be fixed!
How I do leave Quantity in place?
Not sure if the templates have changed since you posted this, but here is what I used of your modified code to make it work:

In viewinvoice.tpl
[co]
  • {php}
  • global $text, $newdescription;
  • $this_invoice_item = $this->get_template_vars('item');
  • $this_item_description = $this_invoice_item['description'];
  • $text = preg_replace("/\:\s0\sx\s/","+",$this_item_description);
  • $text = preg_replace("/.*\+/","+",$text);
  • $text = preg_replace("/\+.*/","",$text);
  • $this->assign('newdescription',$text);
  • {/php}
  • [/co]
    and in invoicepdf.tpl

    [co]
  • foreach ($invoiceitems AS $item) {
  • $text = preg_replace("/\:\s0\sx\s/","+",$item['description']);
  • $text = preg_replace("/.*\+/","+",$text);
  • $text = preg_replace("/\+.*(\n?)/","",$text);
  • $tblhtml .= '
  • <tr bgcolor="#fff">
  • <td align="left">'.nl2br($text).'<br /></td>
  • <td align="center">'.$item['amount'].'</td>
  • </tr>';
  • }
  • [/co]
    These seemed to work for me on the default when I had issues just pasting your code in there. But your code got me 95% of the way there and now I know some smarty and more php.
    I still REALLY think this should be built in, but I have created some code we can add to fix it.
    **Tested Working on our system, but use at your own risk**

    invoice.tpl (Starting on Line 92 for us, within the foreach loop)
    [co]
  • {php}
    $text = preg_replace("/\:\s0\sx\s/","+",$this->_tpl_vars['invoiceitem']['description']);
    $text = preg_replace("/.*\+/","+",$text);
    $text = preg_replace("/\+.*/","",$text);
    $this->_tpl_vars['invoiceitem']['description'] = $text;
    {/php}
  • [/co]
    invoicepdf.tpl (Replace this whole foreach loop)
    [co]
  • foreach ($invoiceitems AS $item) {
    //These 3 lines remove 0 Quantity items, and the 4th line set the new string to the running variable
    $text = preg_replace("/\:\s0\sx\s/","+",$item['description']);
    $text = preg_replace("/.*\+/","+",$text);
    $text = preg_replace("/\+.*(\n?)/","",$text);
    $item['description'] = $text;

    $rowcount = $pdf->getNumLines($item['description'], 140);

    $pdf->MultiCell(140,$rowcount * 5,$item['description'],1,'L',0,0);
    $pdf->MultiCell(40,$rowcount * 5,$item['amount'],1,'C',0,0);
    $pdf->Ln();
    }
  • [/co]
    You're Welcome : )
    -Stephen
    Hi, have you manage to get this running in 7.6.1?
    I agree, no need to show items not ordered on the invoice!