Automattic\WooCommerce\Gateways\PayPal
Notices::add_paypal_account_restricted_notice
Add notice warning about PayPal account restriction.
Method of the class: Notices{}
No Hooks.
Returns
null. Nothing (null).
Usage
// private - for code of main (parent) class only $result = $this->add_paypal_account_restricted_notice(): void;
Changelog
| Since 10.5.0 | Introduced. |
Notices::add_paypal_account_restricted_notice() Notices::add paypal account restricted notice code WC 10.7.0
private function add_paypal_account_restricted_notice(): void {
// Skip if there's no account restriction flag.
if ( ! $this->has_account_restriction_flag() ) {
return;
}
// Skip if the notice has been dismissed.
if ( $this->is_notice_dismissed( self::PAYPAL_ACCOUNT_RESTRICTED_NOTICE ) ) {
return;
}
$support_url = 'https://www.paypal.com/smarthelp/contact-us';
$dismiss_url = $this->get_dismiss_url( self::PAYPAL_ACCOUNT_RESTRICTED_NOTICE );
$message = sprintf(
/* translators: 1: opening <a> tag, 2: closing </a> tag */
esc_html__( 'Your PayPal account has been restricted by PayPal. This may prevent customers from completing payments. Please %1$scontact PayPal support%2$s to resolve this issue and restore full functionality to your account.', 'woocommerce' ),
'<a href="' . esc_url( $support_url ) . '" target="_blank" rel="noopener noreferrer">',
'</a>',
);
$notice_html = '<div class="notice notice-error 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><strong>' . esc_html__( 'PayPal Account Restricted', 'woocommerce' ) . '</strong></p>'
. '<p>' . $message . '</p>'
. '</div>';
echo wp_kses_post( $notice_html );
}