Snippet to Log “Payment Failed” in Syslog [closed]
You can use the woocommerce_order_status_changed action to find a failed order transition, and syslog to write your log, assuming the function is not disabled in your PHP configuration. add_action( ‘woocommerce_order_status_changed’, function ( $order_id, $old_status, $new_status ) { if ( ‘failed’ !== $new_status ) { return; } $order = wc_get_order( $order_id ); if ( ! $order … Read more