diff --git a/modules/ppcp-button/src/Assets/SmartButton.php b/modules/ppcp-button/src/Assets/SmartButton.php index ac4126f5b..e83510873 100644 --- a/modules/ppcp-button/src/Assets/SmartButton.php +++ b/modules/ppcp-button/src/Assets/SmartButton.php @@ -728,7 +728,7 @@ class SmartButton implements SmartButtonInterface { private function payerData() { $customer = WC()->customer; - if ( ! is_user_logged_in() || ! is_a( $customer, \WC_Customer::class ) ) { + if ( ! is_user_logged_in() || ! ( $customer instanceof \WC_Customer ) ) { return null; } return $this->payer_factory->from_customer( $customer )->to_array(); @@ -757,7 +757,7 @@ class SmartButton implements SmartButtonInterface { if ( $this->environment->current_environment_is( Environment::SANDBOX ) && defined( 'WP_DEBUG' ) && \WP_DEBUG && is_user_logged_in() - && WC()->customer && WC()->customer->get_billing_country() + && WC()->customer instanceof \WC_Customer && WC()->customer->get_billing_country() && 2 === strlen( WC()->customer->get_billing_country() ) ) { $params['buyer-country'] = WC()->customer->get_billing_country(); diff --git a/modules/ppcp-button/src/Endpoint/CreateOrderEndpoint.php b/modules/ppcp-button/src/Endpoint/CreateOrderEndpoint.php index d8c473bfa..bf6683c63 100644 --- a/modules/ppcp-button/src/Endpoint/CreateOrderEndpoint.php +++ b/modules/ppcp-button/src/Endpoint/CreateOrderEndpoint.php @@ -285,7 +285,7 @@ class CreateOrderEndpoint implements EndpointInterface { * @throws RuntimeException If create order request fails. */ private function create_paypal_order( \WC_Order $wc_order = null ): Order { - $needs_shipping = WC()->cart && WC()->cart->needs_shipping(); + $needs_shipping = WC()->cart instanceof \WC_Cart && WC()->cart->needs_shipping(); $shipping_address_is_fix = $needs_shipping && 'checkout' === $this->parsed_request_data['context']; return $this->api_endpoint->create( diff --git a/modules/ppcp-subscription/src/SubscriptionModule.php b/modules/ppcp-subscription/src/SubscriptionModule.php index aca30b3bb..3be24af3d 100644 --- a/modules/ppcp-subscription/src/SubscriptionModule.php +++ b/modules/ppcp-subscription/src/SubscriptionModule.php @@ -112,7 +112,7 @@ class SubscriptionModule implements ModuleInterface { * @return void */ protected function renew( $order, $container ) { - if ( ! is_a( $order, \WC_Order::class ) ) { + if ( ! ( $order instanceof \WC_Order ) ) { return; }