WC_Checkout::send_ajax_failure_response()
If checkout failed during an AJAX call, send failure response.
Method of the class: WC_Checkout{}
No Hooks.
Return
null
. Nothing.
Usage
// protected - for code of main (parent) or child class $result = $this->send_ajax_failure_response();
WC_Checkout::send_ajax_failure_response() WC Checkout::send ajax failure response code WC 7.7.0
protected function send_ajax_failure_response() { if ( wp_doing_ajax() ) { // Only print notices if not reloading the checkout, otherwise they're lost in the page reload. if ( ! isset( WC()->session->reload_checkout ) ) { $messages = wc_print_notices( true ); } $response = array( 'result' => 'failure', 'messages' => isset( $messages ) ? $messages : '', 'refresh' => isset( WC()->session->refresh_totals ), 'reload' => isset( WC()->session->reload_checkout ), ); unset( WC()->session->refresh_totals, WC()->session->reload_checkout ); wp_send_json( $response ); } }