mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
Fix setting the shipping to null in PurchaseUnitFactory
The country code can be empty because the shipping is not mandatory information. If it's not configured from WC the value is empty. Fixes #3
This commit is contained in:
parent
2182147f11
commit
f67bac7c43
1 changed files with 3 additions and 2 deletions
|
@ -8,7 +8,6 @@ use Inpsyde\PayPalCommerce\ApiClient\Entity\AmountBreakdown;
|
|||
use Inpsyde\PayPalCommerce\ApiClient\Entity\Item;
|
||||
use Inpsyde\PayPalCommerce\ApiClient\Entity\Money;
|
||||
use Inpsyde\PayPalCommerce\ApiClient\Entity\PurchaseUnit;
|
||||
use Inpsyde\PayPalCommerce\ApiClient\Entity\Shipping;
|
||||
use Inpsyde\PayPalCommerce\ApiClient\Exception\RuntimeException;
|
||||
|
||||
class PurchaseUnitFactory
|
||||
|
@ -105,7 +104,9 @@ class PurchaseUnitFactory
|
|||
$breakdown
|
||||
);
|
||||
$shipping = $this->shippingFactory->fromWcOrder($order);
|
||||
if ($shipping->address()->countryCode() && !$shipping->address()->postalCode()) {
|
||||
if (empty($shipping->address()->countryCode()) ||
|
||||
($shipping->address()->countryCode() && !$shipping->address()->postalCode())
|
||||
) {
|
||||
$shipping = null;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue