From 5089b6335fd8a78ac470aa9947c4cab4860eaff7 Mon Sep 17 00:00:00 2001 From: dinamiko Date: Fri, 25 Mar 2022 10:14:54 +0100 Subject: [PATCH] Add custom checkout validation (WIP) --- .../src/Gateway/PayUponInvoice/PayUponInvoice.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/modules/ppcp-wc-gateway/src/Gateway/PayUponInvoice/PayUponInvoice.php b/modules/ppcp-wc-gateway/src/Gateway/PayUponInvoice/PayUponInvoice.php index 28e9ccb34..dbec919d0 100644 --- a/modules/ppcp-wc-gateway/src/Gateway/PayUponInvoice/PayUponInvoice.php +++ b/modules/ppcp-wc-gateway/src/Gateway/PayUponInvoice/PayUponInvoice.php @@ -98,6 +98,14 @@ class PayUponInvoice { } return $description; }, 10, 2); + + add_action('woocommerce_checkout_order_processed', function($order_id, $posted_data, $order) { + if($order->get_billing_country() !== 'DE') { + wp_send_json_error(array( + 'result' => 'failure', + )); + } + }, 10, 3); } public function add_parameter_block() { ?>