WC_Woo_Helper_Connection::get_connection_url_noticepublic staticWC 1.0

Get the notice for the connection URL mismatch.

Method of the class: WC_Woo_Helper_Connection{}

No Hooks.

Returns

String. The notice for the connection URL mismatch.

Usage

$result = WC_Woo_Helper_Connection::get_connection_url_notice(): string;

WC_Woo_Helper_Connection::get_connection_url_notice() code WC 10.7.0

public static function get_connection_url_notice(): string {
	$connection_data = WC_Helper::get_cached_connection_data();
	if ( false === $connection_data || ! empty( $connection_data['maybe_deleted_connection'] ) || false === ( $connection_data['alert_url_mismatch'] ?? false ) ) {
		return '';
	}

	$auth     = WC_Helper_Options::get( 'auth' );
	$url_raw  = is_array( $auth ) ? ( $auth['url'] ?? '' ) : '';
	$url      = esc_html( rtrim( $url_raw, '/' ) );
	$home_url = esc_html( rtrim( home_url(), '/' ) );
	if ( empty( $url ) || $home_url === $url ) {
		return '';
	}

	return sprintf(
	/* translators: 1: WooCommerce.com connection URL, 2: home URL */
		__( 'Your site is currently connected to WooCommerce.com using <b>%1$s</b>, but your actual site URL is <b>%2$s</b>. To fix this, please reconnect your site to <b>WooCommerce.com</b> to ensure everything works correctly.', 'woocommerce' ),
		$url,
		$home_url
	);
}