I was trying to add one more callback function to wordpress ajax action
woocommerce_apply_coupon
this wp_ajax action is defined in woocommerce plugin,I want to add my own callback function on this action from my plugin file .
what i have tried –
add_action( 'wp_ajax_nopriv_woocommerce_apply_coupon','darn',999);
add_action( 'wp_ajax_woocommerce_apply_coupon', 'darn',999);
function darn(){
print_r($_REQUEST);
exit;
}
Doing this in my functions.php is not even showing any error, like i cant see any effect of this code.
want to know if this is even possible to achieve . Thankyou.
well i would like to answer my own question since nobody seems to answer it .
by setting priority to one (giving my callback function the top priority) it actually worked !
This is untested, but I’d try to solve it removing the original actions after all plugins are loaded, and then adding your substitute: