jimlongo Posted April 4, 2018 Share Posted April 4, 2018 I'm trying to write a hook that will redirect to the proper cart gid. The inbound URL will look like https://mywhmcs.com/cart.php?prod=2.03 I want to redirect that to https://mywhmcs.com/cart.php?gid=2 . . . some idea of the many things I've attempted add_hook('ClientAreaPageCart', 1, function ($vars) { if ($_GET($vars['prod']) === '2.03'){ return $base_url . '/gid=2'; } }); Thanks for any help. Link to comment Share on other sites More sharing options...
jimlongo Posted April 4, 2018 Author Share Posted April 4, 2018 This works, but I'm not sure there isn't a better way to redirect to the URL (doesn't the constant WEB_ROOT work?). add_hook('ClientAreaPageCart', 1, function ($vars){ if ($_GET["product"] === 2.03){ $url = '/cart.php?gid=2'; while (ob_get_status()) { ob_end_clean(); } header( "Location: $url" ); } }); Link to comment Share on other sites More sharing options...
brian! Posted April 5, 2018 Share Posted April 5, 2018 18 hours ago, jimlongo said: doesn't the constant WEB_ROOT work? it should be available as $vars['WEB_ROOT'] Link to comment Share on other sites More sharing options...
Recommended Posts