From 35b1ff51fc48e1aadac20e516defeb7b6aedb78c Mon Sep 17 00:00:00 2001 From: Grant Date: Wed, 17 Jan 2024 13:57:45 +0900 Subject: [PATCH 1/4] Send shipping_address when default shipping_address is the billing_address --- class-wc-gateway-komoju.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/class-wc-gateway-komoju.php b/class-wc-gateway-komoju.php index 442b6fc..aa02943 100755 --- a/class-wc-gateway-komoju.php +++ b/class-wc-gateway-komoju.php @@ -173,6 +173,8 @@ public function create_session_for_order($order_id, $payment_type = null) } $shipping_address = null; + $ship_to_billing = get_option('woocommerce_ship_to_destination') === 'billing'; + if ($order->has_shipping_address()) { $shipping_address = [ 'zipcode' => $order->get_shipping_postcode(), @@ -182,6 +184,8 @@ public function create_session_for_order($order_id, $payment_type = null) 'state' => $order->get_shipping_state(), 'city' => $order->get_shipping_city(), ]; + } elseif($ship_to_billing) { + $shipping_address = $billing_address; } // new session From 188b7cb80b38410802867dceae4544a714bb2cf0 Mon Sep 17 00:00:00 2001 From: Grant Date: Wed, 17 Jan 2024 15:32:33 +0900 Subject: [PATCH 2/4] lint --- .vscode/launch.json | 11 +++++++++++ class-wc-gateway-komoju.php | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 .vscode/launch.json diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..d8f6bf5 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,11 @@ +{ + "configurations": [ + + { + "name": "Listen for Xdebug", + "type": "php", + "request": "launch", + "port": 9003, + } + ] +} \ No newline at end of file diff --git a/class-wc-gateway-komoju.php b/class-wc-gateway-komoju.php index aa02943..69fb5fe 100755 --- a/class-wc-gateway-komoju.php +++ b/class-wc-gateway-komoju.php @@ -184,7 +184,7 @@ public function create_session_for_order($order_id, $payment_type = null) 'state' => $order->get_shipping_state(), 'city' => $order->get_shipping_city(), ]; - } elseif($ship_to_billing) { + } elseif ($ship_to_billing) { $shipping_address = $billing_address; } From d5c626c7d798ec017fd3aa5dd32b12d2f8088bf8 Mon Sep 17 00:00:00 2001 From: Grant Date: Wed, 17 Jan 2024 15:39:45 +0900 Subject: [PATCH 3/4] remove unnecessary file --- .vscode/launch.json | 11 ----------- 1 file changed, 11 deletions(-) delete mode 100644 .vscode/launch.json diff --git a/.vscode/launch.json b/.vscode/launch.json deleted file mode 100644 index d8f6bf5..0000000 --- a/.vscode/launch.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "configurations": [ - - { - "name": "Listen for Xdebug", - "type": "php", - "request": "launch", - "port": 9003, - } - ] -} \ No newline at end of file From 57c7b7fdc0df88ca1e4144b0ff9882734ff9fabb Mon Sep 17 00:00:00 2001 From: Grant Date: Wed, 17 Jan 2024 15:56:40 +0900 Subject: [PATCH 4/4] lint --- class-wc-gateway-komoju.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/class-wc-gateway-komoju.php b/class-wc-gateway-komoju.php index 69fb5fe..6372757 100755 --- a/class-wc-gateway-komoju.php +++ b/class-wc-gateway-komoju.php @@ -173,7 +173,7 @@ public function create_session_for_order($order_id, $payment_type = null) } $shipping_address = null; - $ship_to_billing = get_option('woocommerce_ship_to_destination') === 'billing'; + $ship_to_billing = get_option('woocommerce_ship_to_destination') === 'billing'; if ($order->has_shipping_address()) { $shipping_address = [