[Feature Request] Remove options in the "X years" dropdown depending on TLD
My Registrar sends via "TLD Import & Pricing Sync" Pricing always for 10 Years but some of this Domains are on Sale (1$ or 2$). Sale-Domains can be registered as New only for 1 Year, and Renew is for multiple Years possible again.
-
Register only 1 Year on specific Domains as an Option and Renew 1-5 Years
-
Sync "TLD Import & Pricing Sync" every day automatically
https://whmcs.community/topic/303608-domain-tld-filter-years-register-renew/
This hook is my first attempt. It removes domain billing cycles based on TLD.
Working if u are not logged in. For logged in Customers there is no change
Replace ClientAreaPage with ClientAreaPageCart seems fixed.
Let's ignore for a moment the hook point.
In my first attempt I was focusing just on cart.php. There's another page where we need to add the same restrictions. I'm referring to "Renew Domain" page. The updated version of the hook restricts billing cycles for both pages. Please try it and let me know.
Replacing with new Version of Code doesn't work anymore. New and Renew too.
Please, post me your configuration. Basically I need to know the values of $restrictedTLDs and $restrictedPeriods variables.
This is my Config:
add_hook('ClientAreaPage', 1, function($vars) { if (($vars['filename'] == 'cart' AND $_GET['a'] == 'view') OR $vars['templatefile'] == 'domain-renewals') { $restrictedTLDs = array('.com', '.net', '.org', '.eu', '.info', '.store', '.xyz', '.work', '.top', '.icu', '.cloud', '.club', '.click', '.business', '.asia', '.art', '.company', '.cyou', '.in', '.io'); // Specify TLD for which you want to restrict billing cycles. TLD must start with a dot "." $restrictedPeriods = array('2', '3', '4', '5', '6', '7', '8', '9', '10'); // Any value from 1 to 10 (1 year, 2 years, 3 years... 10 years)