Syrtox Posted June 26 Share Posted June 26 Hello Community, The following use case should be implemented: If the admin accepts an order within the admin area, business logic is executed within the "AcceptOrder" hook and if an error occurs, an error message should appear in the "AdminHomepage" template or similar. Similar to this post: The "AcceptOrder" hook has no return. The only option I have researched is to throw an exception, as in this example: <?php //currently add_hook('AcceptOrder', 1, function($vars) { //...do business logic if($something == "error"){ throw new Exception("OrderAccept Exception!"); } }); //What I'm looking for add_hook('AcceptOrder', 1, function($vars) { global $errormessage; //...do business logic if($something == "error"){ //..... $errormessage = 'ERROR_MESSAGE'; //will show on AdminHomepage or similar } }); Is this possible? 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.