Jump to content

Auto-Terminate Free Trials After X Minutes


Kian

Recommended Posts

Free trials for a limited period is a good marketing strategy to capitalize on the leads you get. The problem with trials is that the smallest unit of time for WHMCS is the day meaning that for example you can't provide a trial for VPS that last for a couple of hours. WHMCS can't "think" for a period of less than a full day.

The following action hook allows to automatically terminate the given products/services after a certain number of minutes. It runs AfterCronJob hook point that normally triggers once every 5 minutes. Visit Setup > Automation Settings and make sure that cron.php runs every 5 minutes as suggested by WHMCS. The hook will do the rest. It also logs terminations in Activity Log.

Get the Code »

Link to comment
Share on other sites

  • 1 month later...

The script has been updated with two new features.

First. You can perform Termination or Suspension.

Second. The previous version of the hook worked only for products/services using a server module (eg. Plesk, cPanel etc.). Now it works also with "basic" services not assigned to any server module. In other words services with no Create, Suspend, Unuspend and Terminate button. In this case the script updates the status accordigly.

I'm also planning to make the hook work with multiple conditions like in the following example:

  • Product ID 10 suspended after 10 minutes
  • Product ID 12, 13 and 14 suspended after 8 hours
Edited by Kian
Link to comment
Share on other sites

×
×
  • 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