akust0m Posted December 6, 2022 Share Posted December 6, 2022 (edited) Hey! I'm looking for a way via a hook to remove the 'Request Cancellation' button for specific product ID or product groups. Or, perhaps to update the link for this button for specific product ID or product groups? Does anyone happen to have a hook snippet handy? Thank you in advance 🙂 Edited December 6, 2022 by akust0m 0 Quote Link to comment Share on other sites More sharing options...
AladdinJ Posted December 6, 2022 Share Posted December 6, 2022 (edited) hello I have written it now and tested it for you this is for specific product IDs <?php if (!defined("WHMCS")) die("This file cannot be accessed directly"); use WHMCS\View\Menu\Item as MenuItem; add_hook('ClientAreaPrimarySidebar', 1, function (MenuItem $primarySidebar) { $pid_to_hide = array(5); // product id you want to hide cancel button for $service = Menu::context('service'); $pid = (int) $service->packageId; if (in_array($pid,$pid_to_hide)) { if (!is_null($primarySidebar->getChild('Service Details Actions'))) { $primarySidebar->getChild('Service Details Actions') ->removeChild('Cancel'); } } }); Â Â Edited December 6, 2022 by AladdinJ 0 Quote Link to comment Share on other sites More sharing options...
AladdinJ Posted December 6, 2022 Share Posted December 6, 2022 and this one for Product group also if you want  add_hook('ClientAreaPrimarySidebar', 1, function (MenuItem $primarySidebar) { $productGroupId_to_hide = array(2); // product groupe ids you want to hide cancel button for $service = Menu::context('service'); $product = $service->product; $productGroupId = $product->productGroupId; if (in_array($productGroupId,$productGroupId_to_hide)) { if (!is_null($primarySidebar->getChild('Service Details Actions'))) { $primarySidebar->getChild('Service Details Actions') ->removeChild('Cancel'); } } });  1 Quote Link to comment Share on other sites More sharing options...
Humanbeing Posted December 7, 2022 Share Posted December 7, 2022 Thank you @AladdinJ 0 Quote Link to comment Share on other sites More sharing options...
akust0m Posted December 7, 2022 Author Share Posted December 7, 2022 Thank you so much @AladdinJ 🙂 0 Quote Link to comment Share on other sites More sharing options...
AladdinJ Posted December 7, 2022 Share Posted December 7, 2022 @Mandalorian @akust0m You’re welcome 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.