Stop coupon creation and email sending

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!

If you want to create your own function to run after order is completed, or for some reason you don't need creation of a coupon, add this code to your functions.php file and it will prevent creation of referral coupons and sending of emails. 

add_action( 'wp_loaded', 'wpgens_override' );
function wpgens_override(){
    $gens_plugin = WPGens_RAF::instance();
    remove_action( 'woocommerce_order_status_completed', array( $gens_plugin->order_object, 'gens_maybe_create_send_coupon' ), 10 );    
}

After that, maybe you want to call the coupon sending and creation within your function, which you could do with following code, by passing the order id:

	$gens_plugin = WPGens_RAF::instance();
	$gens_plugin->order_object->gens_maybe_create_send_coupon(734);

That's it. :)

Still need help? Contact Us Contact Us