Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add shipping_address to the API request when the default shipping_address is the billing_address #97

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions class-wc-gateway-komoju.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand All @@ -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
Expand Down
Loading