codemaster2008 Posted July 17, 2010 Share Posted July 17, 2010 Hi; I'm already using WHMCS built in free domains feature to offer free domain for a few different tld's. So I'm trying to use action hooks to do the following: - If payment term is "Annually", give the user free ".com.br" domain registration. To accomplish that i have a few options: a) Add a new product to the shopping cart which could be a discount (with a negative value) and at the end the user won't pay for the domain. b) Change the domain registration price to $0 (not sure if it's even possible) I can hook to the "PreCalculateCartTotals" actions and test the condition but unfortunatelly i don't know how to continue from there (I'm not a php guy). function freebrDomain($vars) { foreach ($_SESSION['cart']['domains'] as $domain) { if (strstr($domain['domain'], ".com.br")) { /* DO SOMETHING IN HERE */ } } } add_hook("PreCalculateCartTotals",1,"freebrDomain"); I already tried to hire WHMCS guys to do this for me but my ticket wasn't answer (i sent it a few days ago), so I'm hoping somebody out there can help me with that. It also would cover the following possibilities: 1- Add discounts on change price for each .com.br domain included on a product with Annual payment. 2- Consider the user can go back and remove product or change payment terms so, has to be tested and adjusted every time to show the correct total. Thanks in advance; 0 Quote Link to comment Share on other sites More sharing options...
laszlof Posted July 18, 2010 Share Posted July 18, 2010 You could create a couple for the free domain name if you wanted. Then just add this into your code: $_SESSION['cart']['promo'] = 'MYCOUPONCODE'; This *should* work, but its untested. Good luck! 0 Quote Link to comment Share on other sites More sharing options...
codemaster2008 Posted July 18, 2010 Author Share Posted July 18, 2010 sounds like a plan. I will try that. 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.