Jump to content

InvoiceCreationPreEmail Hook for monthly services invoice only

Recommended Posts

Dear friends,

I want to create some Hook using InvoiceCreationPreEmail

that will effect only the invoices that include ONLY monthly monthly subscription items


any suggestion how can I filter it and effect with InvoiceCreationPreEmail only monthly subscription invoices?


mean, even if invoice include both monthly payment and billable item / other payment, it's will not pass the check and the hook will not work for that, but invoices with ONLY monthly payment lines will pass the hook action.


Please advice,




Link to comment
Share on other sites

WHMCS Support reply to this Post:

The invoices themselves do not specify a billing cycle, that is stored in the tblhosting.billingcycle field.

So to access that you'd need to take the invoice ID (available in the hook point variables) then look up the invoice line items using the tblinvoiceitems.invoiceid field. Then use the tblinvoiceitems.relid field of the row to search the tblhosting.id field which will identify the service to which the line item relates.

Then you can check the billingcycle field for that record to see whether it is monthly or not.


thanks to John, WHMCS Support for that help!

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