mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 10:55:00 +08:00
make sure shipping is needed when setting up application context.
When no shipping zones are defined the WC_Order which is patched later will not contain a shipping address. When we set up the order with a fixed shipping address from file, this will result in an API error. Therefore, we need to check upfront, if shipping is needed.
This commit is contained in:
parent
97c78b02a9
commit
3e2f811959
1 changed files with 2 additions and 1 deletions
|
@ -162,7 +162,8 @@ class CreateOrderEndpoint implements EndpointInterface {
|
|||
}
|
||||
|
||||
$this->set_bn_code( $data );
|
||||
$shipping_address_is_fix = 'checkout' === $data['context'] ? true : false;
|
||||
$needs_shipping = WC()->cart && WC()->cart->needs_shipping();
|
||||
$shipping_address_is_fix = $needs_shipping && 'checkout' === $data['context'] ? true : false;
|
||||
$order = $this->api_endpoint->create(
|
||||
$purchase_units,
|
||||
$this->payer( $data, $wc_order ),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue