WC_Query::get_errors()publicWC 1.0

Get any errors from querystring.

Method of the class: WC_Query{}

No Hooks.

Return

null. Nothing (null).

Usage

$WC_Query = new WC_Query();
$WC_Query->get_errors();

WC_Query::get_errors() code WC 8.7.0

public function get_errors() {
	// phpcs:ignore WordPress.Security.NonceVerification.Recommended
	$error = ! empty( $_GET['wc_error'] ) ? sanitize_text_field( wp_unslash( $_GET['wc_error'] ) ) : '';

	if ( $error && ! wc_has_notice( $error, 'error' ) ) {
		wc_add_notice( $error, 'error' );
	}
}