Installation Guidance
Step 1 — Upload Module Files
Extract the package and upload the limit_purchase folder to your WHMCS addons directory:
<whmcs_root>/
└── modules/
└── addons/
└── limit_purchase/
├── limit_purchase.php ← Main module file
└── hooks.php ← Cart validation & trial enforcement hooks
Step 2 — Set File Permissions
Ensure your web server can read the module files. On Linux/cPanel servers:
chmod -R 755 /path/to/whmcs/modules/addons/limit_purchase/
Step 3 — Activate the Module
- Navigate to System Settings → Addon Modules in your WHMCS Admin Panel.
- Locate “Product Limiter” and click Activate.
- Click Configure and complete the following:
- License Key: Enter the license key provided with your purchase.
- Access Control: Select which administrator roles should have access to the module (e.g., Full Administrator).
- Click Save Changes.
Note: Two database tables (mod_limit_purchase and mod_limit_purchase_config) are automatically created upon activation.
Step 4 — Configure Product Limits
- Access the module from Addons → Product Limiter in the top navigation.
- Use the “Create New Rule” form on the left sidebar:
- Target Product: Select the product to limit (products are listed by group for easier identification).
- Purchase Limit: Set the maximum number of times a single client can purchase this product.
- Error Message: Customize the message shown to clients when they hit the limit. Use {PNAME} as a placeholder for the product name.
- Active Rule: Toggle on to enforce the rule immediately.
- Click Save Rule. The rule will appear in the “Enforced Product Limits” table on the right.
Step 5 — Configure Trial Enforcement (Optional)
If you want to require clients to purchase a free/trial product before ordering a paid package:
- In the Global Configuration bar at the top of the module:
- Enable “Require Trial First”
- Enable “Auto-redirect to Trial” toggle if you want clients to be automatically redirected to the trial product.
- Customize the Trial Requirement Dialog Box Message (e.g., “You must activate a free trial before purchasing a paid plan.”).
- Click Save Settings.
Important: Trial enforcement identifies trial products as any product with a paytype of free in WHMCS. Ensure at least one free product exists for this feature to work.
Step 6 — Verify Hook Registration
The module automatically registers two WHMCS hooks: - ShoppingCartValidateCheckout — Intercepts checkout to enforce product limits and trial requirements. - ProductDelete — Automatically removes limit rules when a product is deleted from WHMCS.
No manual hook registration is required. To verify, check Utilities → Logs → Module Log for any limit_purchase entries during a test checkout.
