From 80428f1eb17ca282977f147b6d06add73061d4c2 Mon Sep 17 00:00:00 2001 From: Alex P Date: Mon, 12 Dec 2022 09:18:37 +0200 Subject: [PATCH] Execute WC validation only for buttons in checkout --- modules/ppcp-button/src/Endpoint/CreateOrderEndpoint.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/modules/ppcp-button/src/Endpoint/CreateOrderEndpoint.php b/modules/ppcp-button/src/Endpoint/CreateOrderEndpoint.php index b22b851b9..205505c5c 100644 --- a/modules/ppcp-button/src/Endpoint/CreateOrderEndpoint.php +++ b/modules/ppcp-button/src/Endpoint/CreateOrderEndpoint.php @@ -248,7 +248,11 @@ class CreateOrderEndpoint implements EndpointInterface { $form_fields = $data['form'] ?? null; - if ( $this->early_validation_enabled && is_array( $form_fields ) ) { + if ( $this->early_validation_enabled + && is_array( $form_fields ) + && 'checkout' === $data['context'] + && in_array( $payment_method, array( PayPalGateway::ID, CardButtonGateway::ID ), true ) + ) { $this->validate_form( $form_fields ); }