diff --git a/src/Gateway/GatewayModule.php b/src/Gateway/GatewayModule.php index b8987f10..7be51958 100644 --- a/src/Gateway/GatewayModule.php +++ b/src/Gateway/GatewayModule.php @@ -734,6 +734,9 @@ public function addPaymentMethodMandatoryFields($fields, string $gatewayName, st if ($fields['payment_method'] !== $gatewayName) { return $fields; } + if (!empty($fields['billing_company'])) { + return $fields; + } if (!isset($fields[$field])) { $fieldPosted = filter_input(INPUT_POST, $field, FILTER_SANITIZE_SPECIAL_CHARS) ?? false; if ($fieldPosted) { diff --git a/src/Payment/MollieObject.php b/src/Payment/MollieObject.php index 7d4c6968..4cae22e4 100644 --- a/src/Payment/MollieObject.php +++ b/src/Payment/MollieObject.php @@ -1109,7 +1109,7 @@ private function checkBillieCompanyField($order) $isBillieMethodId = $gateway->id === 'mollie_wc_gateway_billie'; if ($isBillieMethodId) { //phpcs:ignore WordPress.Security.NonceVerification, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized - $fieldPosted = wc_clean(wp_unslash($_POST["billing_company"] ?? '')); + $fieldPosted = wc_clean(wp_unslash($_POST["billing_company_billie"] ?? $_POST["billing_company"] ?? '')); if ($fieldPosted === '' || !is_string($fieldPosted)) { return null; } diff --git a/src/PaymentMethods/PaymentFieldsStrategies/BillieFieldsStrategy.php b/src/PaymentMethods/PaymentFieldsStrategies/BillieFieldsStrategy.php index 3b8ac4bf..51502006 100644 --- a/src/PaymentMethods/PaymentFieldsStrategies/BillieFieldsStrategy.php +++ b/src/PaymentMethods/PaymentFieldsStrategies/BillieFieldsStrategy.php @@ -17,7 +17,7 @@ public function execute($gateway, $dataHelper) $showCompanyField = empty($order->get_billing_company()); } - if (is_checkout() && !is_checkout_pay_page()) { + if (is_checkout() && !is_checkout_pay_page() && !isset(WC()->checkout()->get_checkout_fields()['billing']['billing_company'])) { $showCompanyField = true; }