WooCommerce Code Reference

Notices
in package

PayPal Notices Class

Handles admin notices for PayPal gateway including migration notices, account restriction warnings, and currency support notifications.

Tags
since
10.5.0

Table of Contents

PAYPAL_ACCOUNT_RESTRICTION_ISSUES  = array(AutomatticWooCommerceGatewaysPayPalConstants::PAYPAL_ISSUE_PAYEE_ACCOUNT_LOCKED_OR_CLOSED, AutomatticWooCommerceGatewaysPayPalConstants::PAYPAL_ISSUE_PAYEE_ACCOUNT_RESTRICTED)
PayPal account restriction issue codes from PayPal API.
PAYPAL_ACCOUNT_RESTRICTED_NOTICE  = 'paypal_account_restricted'
The name of the notice for PayPal account restriction.
PAYPAL_MIGRATION_NOTICE  = 'paypal_migration_completed'
The name of the notice for PayPal migration.
PAYPAL_UNSUPPORTED_CURRENCY_NOTICE  = 'paypal_unsupported_currency'
The name of the notice for PayPal unsupported currency.
$gateway  : WC_Gateway_Paypal
The PayPal gateway instance.
__construct()  : mixed
Constructor.
add_paypal_migration_notice()  : void
Add notice warning about the migration to PayPal Payments.
add_paypal_notices()  : void
Add PayPal Standard notices.
add_paypal_notices_on_payments_settings_page()  : void
Add PayPal notices on the payments settings page.
clear_account_restriction_flag()  : void
Clear the flag indicating PayPal account restriction.
manage_account_restriction_flag_for_notice()  : void
Handle PayPal order response to manage account restriction notices.
set_account_restriction_flag()  : void
Set the flag indicating PayPal account restriction.
add_paypal_account_restricted_notice()  : void
Add notice warning about PayPal account restriction.
add_paypal_unsupported_currency_notice()  : void
Add notice warning when PayPal does not support the store's currency.
get_dismiss_url()  : string
Get the dismiss URL for a notice.
has_account_restriction_flag()  : bool
Check if there's a flag indicating PayPal account restriction.
is_notice_dismissed()  : bool
Check if the notice has been dismissed.

Constants

PAYPAL_ACCOUNT_RESTRICTION_ISSUES

PayPal account restriction issue codes from PayPal API.

protected array<string|int, mixed> PAYPAL_ACCOUNT_RESTRICTION_ISSUES = array(AutomatticWooCommerceGatewaysPayPalConstants::PAYPAL_ISSUE_PAYEE_ACCOUNT_LOCKED_OR_CLOSED, AutomatticWooCommerceGatewaysPayPalConstants::PAYPAL_ISSUE_PAYEE_ACCOUNT_RESTRICTED)
Tags
since
10.5.0

PAYPAL_ACCOUNT_RESTRICTED_NOTICE

The name of the notice for PayPal account restriction.

private string PAYPAL_ACCOUNT_RESTRICTED_NOTICE = 'paypal_account_restricted'
Tags
since
10.5.0

PAYPAL_MIGRATION_NOTICE

The name of the notice for PayPal migration.

private string PAYPAL_MIGRATION_NOTICE = 'paypal_migration_completed'
Tags
since
10.5.0

PAYPAL_UNSUPPORTED_CURRENCY_NOTICE

The name of the notice for PayPal unsupported currency.

private string PAYPAL_UNSUPPORTED_CURRENCY_NOTICE = 'paypal_unsupported_currency'
Tags
since
10.5.0

Properties

Methods

add_paypal_migration_notice()

Add notice warning about the migration to PayPal Payments.

public add_paypal_migration_notice() : void
Tags
since
10.5.0
Return values
void

add_paypal_notices()

Add PayPal Standard notices.

public add_paypal_notices() : void
Tags
since
10.5.0
Return values
void

add_paypal_notices_on_payments_settings_page()

Add PayPal notices on the payments settings page.

public add_paypal_notices_on_payments_settings_page() : void
Tags
since
10.5.0
Return values
void

clear_account_restriction_flag()

Clear the flag indicating PayPal account restriction.

public static clear_account_restriction_flag() : void
Tags
since
10.5.0
Return values
void

manage_account_restriction_flag_for_notice()

Handle PayPal order response to manage account restriction notices.

public static manage_account_restriction_flag_for_notice(int|string $http_code, array<string|int, mixed> $response_data, WC_Order $order) : void
Parameters
$http_code : int|string

The HTTP status code from the PayPal API response.

$response_data : array<string|int, mixed>

The decoded response data from the PayPal API.

$order : WC_Order

The WooCommerce order object.

Tags
since
10.5.0
Return values
void

set_account_restriction_flag()

Set the flag indicating PayPal account restriction.

public static set_account_restriction_flag() : void
Tags
since
10.5.0
Return values
void

add_paypal_account_restricted_notice()

Add notice warning about PayPal account restriction.

private add_paypal_account_restricted_notice() : void
Tags
since
10.5.0
Return values
void

add_paypal_unsupported_currency_notice()

Add notice warning when PayPal does not support the store's currency.

private add_paypal_unsupported_currency_notice() : void
Tags
since
10.5.0
Return values
void

get_dismiss_url()

Get the dismiss URL for a notice.

private get_dismiss_url(string $notice_name) : string
Parameters
$notice_name : string

The name of the notice.

Tags
since
10.5.0
Return values
string

has_account_restriction_flag()

Check if there's a flag indicating PayPal account restriction.

private has_account_restriction_flag() : bool
Tags
since
10.5.0
Return values
bool

is_notice_dismissed()

Check if the notice has been dismissed.

private is_notice_dismissed(string $notice_name) : bool

User meta keys for notice dismissals:

  • dismissed_paypal_migration_completed_notice
  • dismissed_paypal_account_restricted_notice
  • dismissed_paypal_unsupported_currency_notice

The meta keys are set by WC_Admin_Notices when the notice is dismissed by the user.

Parameters
$notice_name : string

The name of the notice.

Tags
since
10.5.0
Return values
bool