WC_Helper::get_message_for_response_codeprotected staticWC 1.0

Gets a user-friendly error message based on the HTTP response code.

Method of the class: WC_Helper{}

No Hooks.

Returns

String. The user-friendly error message.

Usage

$result = WC_Helper::get_message_for_response_code( $code ): string;
$code(int) (required)
The HTTP response code.

WC_Helper::get_message_for_response_code() code WC 10.3.3

protected static function get_message_for_response_code( int $code ): string {
	if ( 429 === $code ) {
		return __( 'You have exceeded the request limit. Please try again after a few minutes.', 'woocommerce' );
	} elseif ( 403 === $code ) {
		return __( 'Authentication failed. Please try again after a few minutes. If the issue persists, disconnect your store from WooCommerce.com and reconnect.', 'woocommerce' );
	}

	// translators: %d: HTTP status code.
	return sprintf( __( 'WooCommerce.com API returned HTTP status code %d.', 'woocommerce' ), $code );
}