mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 14:57:26 +08:00
Fix PUI error in editor
This commit is contained in:
parent
f51dbfc6d3
commit
c5381e34ad
1 changed files with 6 additions and 0 deletions
|
@ -9,6 +9,7 @@ declare( strict_types=1 );
|
||||||
|
|
||||||
namespace WooCommerce\PayPalCommerce\WcGateway\Helper;
|
namespace WooCommerce\PayPalCommerce\WcGateway\Helper;
|
||||||
|
|
||||||
|
use WC_Customer;
|
||||||
use WC_Order;
|
use WC_Order;
|
||||||
use WC_Order_Item_Product;
|
use WC_Order_Item_Product;
|
||||||
use WooCommerce\PayPalCommerce\WcGateway\Exception\NotFoundException;
|
use WooCommerce\PayPalCommerce\WcGateway\Exception\NotFoundException;
|
||||||
|
@ -48,6 +49,7 @@ class PayUponInvoiceHelper {
|
||||||
* Checks whether checkout is ready for PUI.
|
* Checks whether checkout is ready for PUI.
|
||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
|
* @psalm-suppress RedundantConditionGivenDocblockType
|
||||||
*/
|
*/
|
||||||
public function is_checkout_ready_for_pui(): bool {
|
public function is_checkout_ready_for_pui(): bool {
|
||||||
$gateway_settings = get_option( 'woocommerce_ppcp-pay-upon-invoice-gateway_settings' );
|
$gateway_settings = get_option( 'woocommerce_ppcp-pay-upon-invoice-gateway_settings' );
|
||||||
|
@ -55,6 +57,10 @@ class PayUponInvoiceHelper {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( ! WC()->customer instanceof WC_Customer ) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// phpcs:ignore WordPress.Security.NonceVerification.Missing
|
// phpcs:ignore WordPress.Security.NonceVerification.Missing
|
||||||
$billing_country = WC()->customer->get_billing_country();
|
$billing_country = WC()->customer->get_billing_country();
|
||||||
if ( empty( $billing_country ) || 'DE' !== $billing_country ) {
|
if ( empty( $billing_country ) || 'DE' !== $billing_country ) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue