Automattic\WooCommerce\Gateways\PayPal

Notices::add_paypal_migration_noticepublicWC 10.5.0

Add notice warning about the migration to PayPal Payments.

Method of the class: Notices{}

No Hooks.

Returns

null. Nothing (null).

Usage

$Notices = new Notices();
$Notices->add_paypal_migration_notice(): void;

Changelog

Since 10.5.0 Introduced.

Notices::add_paypal_migration_notice() code WC 10.7.0

public function add_paypal_migration_notice(): void {
	// Skip if the notice has been dismissed.
	if ( $this->is_notice_dismissed( self::PAYPAL_MIGRATION_NOTICE ) ) {
		return;
	}

	$doc_url     = 'https://woocommerce.com/document/woocommerce-paypal-payments/paypal-payments-upgrade-guide/';
	$dismiss_url = $this->get_dismiss_url( self::PAYPAL_MIGRATION_NOTICE );
	$message     = sprintf(
		/* translators: 1: opening <a> tag, 2: closing </a> tag */
		esc_html__( 'WooCommerce has upgraded your PayPal integration from PayPal Standard to PayPal Payments (PPCP), for a more reliable and modern checkout experience. If you do not prefer the upgraded integration in WooCommerce, we recommend switching to %1$sPayPal Payments%2$s extension.', 'woocommerce' ),
		'<a href="' . esc_url( $doc_url ) . '" target="_blank" rel="noopener noreferrer">',
		'</a>',
	);

	$notice_html = '<div class="notice notice-warning is-dismissible">'
		. '<a class="woocommerce-message-close notice-dismiss" style="text-decoration: none;" href="' . esc_url( $dismiss_url ) . '" aria-label="' . esc_attr__( 'Dismiss this notice', 'woocommerce' ) . '"></a>'
		. '<p>' . $message . '</p>'
		. '</div>';

	echo wp_kses_post( $notice_html );
}