Adjust payment complete order statuses

By default WooCommerce fires the “Payment Complete” hook (trigger) even when a payment is marked as “Failed” or “Cancelled”. If you don’t want the prints to happen for those statuses then add the following code snippet to your website:

function sl_cc_adjust_payment_complete_statuses($statuses){
return array( 'on-hold', 'pending' );
}
add_filter('woocommerce_valid_order_statuses_for_payment_complete', 'sl_cc_adjust_payment_complete_statuses');
Scroll to Top