Action
rpress_ajax_checkout_errors
Fires when checkout errors need to be output for an AJAX request.
Runs just before the request ends, when the AJAX checkout validation or checkout login finds errors (including a failed nonce check). The default callback, rpress_print_errors(), prints the stored errors as HTML and clears them; the JavaScript on the checkout page displays that output.
Example#
add_action( 'rpress_ajax_checkout_errors', 'my_log_checkout_errors', 5 );
function my_log_checkout_errors() {
$errors = rpress_get_errors();
if ( $errors ) {
error_log( wp_json_encode( $errors ) );
}
}
Notes#
Fired from four places: rpress_process_purchase_form() (nonce failure and validation errors) and rpress_process_purchase_login() (nonce failure and login errors). Hook before priority 10 to read the errors before rpress_print_errors() clears them.
Source#
Fired from:
includes/process-purchase.php(line 69), inrpress_process_purchase_form()includes/process-purchase.php(line 138), inrpress_process_purchase_form()includes/process-purchase.php(line 281), inrpress_process_purchase_login()includes/process-purchase.php(line 293), inrpress_process_purchase_login()
See also#
Was this page helpful?
