diff --git a/modules/ppcp-wc-gateway/src/Helper/PayUponInvoiceHelper.php b/modules/ppcp-wc-gateway/src/Helper/PayUponInvoiceHelper.php index b91eca8a0..d84b67cc4 100644 --- a/modules/ppcp-wc-gateway/src/Helper/PayUponInvoiceHelper.php +++ b/modules/ppcp-wc-gateway/src/Helper/PayUponInvoiceHelper.php @@ -9,6 +9,7 @@ declare( strict_types=1 ); namespace WooCommerce\PayPalCommerce\WcGateway\Helper; +use WC_Customer; use WC_Order; use WC_Order_Item_Product; use WooCommerce\PayPalCommerce\WcGateway\Exception\NotFoundException; @@ -48,6 +49,7 @@ class PayUponInvoiceHelper { * Checks whether checkout is ready for PUI. * * @return bool + * @psalm-suppress RedundantConditionGivenDocblockType */ public function is_checkout_ready_for_pui(): bool { $gateway_settings = get_option( 'woocommerce_ppcp-pay-upon-invoice-gateway_settings' ); @@ -55,6 +57,10 @@ class PayUponInvoiceHelper { return false; } + if ( ! WC()->customer instanceof WC_Customer ) { + return false; + } + // phpcs:ignore WordPress.Security.NonceVerification.Missing $billing_country = WC()->customer->get_billing_country(); if ( empty( $billing_country ) || 'DE' !== $billing_country ) {