Automattic\WooCommerce\Gateways\PayPal

Notices::__constructpublicWC 1.0

Constructor.

Method of the class: Notices{}

No Hooks.

Returns

null. Nothing (null).

Usage

$Notices = new Notices();
$Notices->__construct();

Notices::__construct() code WC 10.7.0

public function __construct() {
	$this->gateway = \WC_Gateway_Paypal::get_instance();
	if ( ! $this->gateway ) {
		return;
	}

	// Only register admin notice hooks in the admin area.
	if ( is_admin() ) {
		add_action( 'admin_notices', array( $this, 'add_paypal_notices' ) );

		// Use admin_head to inject notice on payments settings page.
		// This bypasses the suppress_admin_notices() function which removes all admin_notices hooks on the payments page.
		// This is a workaround to avoid the notice being suppressed by the suppress_admin_notices() function.
		add_action( 'admin_head', array( $this, 'add_paypal_notices_on_payments_settings_page' ) );
	}
}