How to send a coupon on other order status than complete?

READ FIRST: This code needs to be added at the end of the functions.php file. If you are familiar with editing functions.php, feel free to continue reading. If you haven't done this before, adding this code in wrong place might bring the site down and the only way to access it is by editing functions.php file again via FTP. Feel free to contact us if you need help!

For example, if you want to generate a coupon code and send an email with coupon on some other order status than complete, you need to add this code to functions.php file:

function gens_raf_change_status( $status ) {
    $status = "processing";
    return $status;  
}
add_filter('wpgens_raf_order_status', 'gens_raf_change_status');

Of course, change order status from "processing" to the other order status you want. 

Still need help? Contact Us Contact Us