Jump to content

Generating an Invoice again that has been deleted


Recommended Posts

I KNOW you shouldn't be deleting invoices but since I am new to WHMCS at the moment I am just playing around with it and testing the features before I go live so...I do want to delete invoices, as well as transactions because these are all fake payments which will affect my finance and stats when I go live.


My question is that I was wondering if there is a way to re-generate an invoice that has already been generated but then deleted?

I know there are ways around this by changing the product next due date but what if I don't want to do that? I am trying to figure out how WHMCS knows that an invoice was generated for that exact date therefore won't generate it again after I delete it; it obviously stores some hidden data which isn't accessible to the WHMCS admin console. This also brings me to another point; is there a way I can delete all records relating to payments, transactions, invoices, orders etc? Is there a script that maybe the WHMCS staff offer for this kind of thing? I'd imagine this happens quite regularly when someone like me uses WHMCS for the first time you obviously want to test it out first before going live with it. I do not want to start a completely new instance of WHMCS because I will lose all my products, clients and customization, I just want to delete payment related info.

Link to comment
Share on other sites

If you simply deleted the invoice - you cant regenerate it



Found the explanation from WHMCS support: WHMCS will never generate a duplicate invoice, even if it's been deleted. So you'll need to move the product's Next Due Date forward or back by 1 day and the renewal invoice will then generate.

Link to comment
Share on other sites

I thought as much....This is stupid though because that means there is data left over if you were doing tests. What if I want to clean the database (without starting again)? Sounds like it leaves traces of crap behind when you delete stuff.

Link to comment
Share on other sites

Here is a hack for this that doesn't leave anything behind as far as I can see and you can keep the same due date, but it takes a few steps.


-View the invoice and delete the line items of the invoice

-Then delete or cancel the invoice

-Edit each service and addon that was on the invoice and set the next due date back one day and click save. Then set the invoice date back to the orignal date and click save again.

-You will now be able to generate a new invoice.


What happens is there is a column in the database called nextinvoicedate that doesn't get set back to the nextduedate when you cancel/delete an invoice. By changing the next due date and then changing it back, WHMCS updates this field again to match the nextduedate which allows for the invoice to be regenerated. You also need to make sure you delete the line items of the invoice or the new invoice will not be generated.

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