PaulGress Posted November 24, 2020 Share Posted November 24, 2020 Hi all, i'm newbie with whmcs and i need help to solve a problem. I'm working with whmcs v. 7.x and actually ( not even in 8.x ) there's a way to change hosting price after 1 year, without creating and using a promotional coupon code . So i need that one of my product hosting with pid=70 that it's price 20.00$ could be changed automatically to 30.00$ in Recurring Amount after 1 year. For only client he's buying it. So after client have bought it and paid invoice, hook could work and update Recurring Amount value in hosting product for client...There's a way to perform it with a hook ? I'm seeing documentation about whmcs hooks and i found the " OrderPaid " . Something below could be works? <?php add_hook('OrderProductPricingOverride', 1, function($vars) { $return = []; if ($vars['pid'] == 70 { $return = ['recurring' => '30.00',]; } return $return; }); Thanks for any help. 0 Quote Link to comment Share on other sites More sharing options...
steven99 Posted November 24, 2020 Share Posted November 24, 2020 You would want to use the OrderPaid hook instead and then set the recurring amount to whatever it should renew at. The change can be done via the UpdateClientProduct API call or via internal classes. 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted November 25, 2020 Share Posted November 25, 2020 and remember that you're just passing a value, and not a currency - e.g if you pass 100 in the hook and the client uses USD, then that's $100; if they use EUR, then its €100 etc. so in a multi-currency situation, you should find the clients currency before determining what value to pass in the hook - if your site only uses one currency, then this won't matter. 0 Quote Link to comment Share on other sites More sharing options...
PaulGress Posted November 28, 2020 Author Share Posted November 28, 2020 On 11/24/2020 at 11:46 PM, steven99 said: You would want to use the OrderPaid hook instead and then set the recurring amount to whatever it should renew at. The change can be done via the UpdateClientProduct API call or via internal classes. Sure thanks Steven, but from documentation hook OrderPaid it hasn't variable $pid , could you guide me to a correct solution so? <?php add_hook('OrderPaid', 1, function($vars) { $return = []; if ($vars['pid'] == 70 { $return = ['recurring' => '30.00',]; } return $return; }); i think that it doesn't work 😕 On 11/25/2020 at 5:00 PM, brian! said: and remember that you're just passing a value, and not a currency - e.g if you pass 100 in the hook and the client uses USD, then that's $100; if they use EUR, then its €100 etc. Hi Brian, thank you, yes i thought it, but i'm using only one currency. Thanks 0 Quote Link to comment Share on other sites More sharing options...
PaulGress Posted January 12, 2021 Author Share Posted January 12, 2021 Someone could give me a suggestion to do it answering my last post ? i'm totally mess :/ Thank you for any suggestion 0 Quote Link to comment Share on other sites More sharing options...
Nelson Neoh Posted July 1, 2021 Share Posted July 1, 2021 On 11/28/2020 at 5:06 PM, PaulGress said: Sure thanks Steven, but from documentation hook OrderPaid it hasn't variable $pid , could you guide me to a correct solution so? Not sure if you still need an answer. Steven had give you a clear direction. Check the https://developers.whmcs.com/api-reference/updateclientproduct/ for the example on how to make a localAPI call. Then place this localAPI call in the OrderPaid hook will do. 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.