Execute WC validation only for buttons in checkout

This commit is contained in:
Alex P 2022-12-12 09:18:37 +02:00
parent 57373e0b81
commit 80428f1eb1
No known key found for this signature in database
GPG key ID: 54487A734A204D71

View file

@ -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 );
}