-
-
Save Pebblo/d854e7b795cf818a365dea031a9b4f86 to your computer and use it in GitHub Desktop.
Creates a log entry when a payment method has been deactivate.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php // Please do not include the opening PHP tag if you already have one. | |
//Debug function to easily write various vars to the log. | |
if ( ! function_exists('tw_ee_write_log')) { | |
function tw_ee_write_log( $log ) { | |
if ( is_array( $log ) || is_object( $log ) ) { | |
error_log( print_r( $log, true ) ); | |
} else { | |
error_log( $log ); | |
} | |
} | |
} | |
add_action('AHEE__EEM_Payment_Method___create_objects_auto_deactivated_payment_method', 'tw_ee_log_pm_deactivate'); | |
function tw_ee_log_pm_deactivate($payment_method) { | |
//Exception for stack trace | |
$e = new \Exception; | |
tw_ee_write_log( | |
array( | |
'payment_method_deactivated' => $payment_method->name(), | |
'stack_trace' => $e->getTraceAsString() | |
) | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment