mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 14:57:26 +08:00
drop shipping in purchase unit when only digital items are in the unit
This commit is contained in:
parent
3aa82347e5
commit
fcd2abc452
1 changed files with 7 additions and 1 deletions
|
@ -149,7 +149,13 @@ class PurchaseUnitFactory {
|
||||||
|
|
||||||
$shipping = null;
|
$shipping = null;
|
||||||
$customer = \WC()->customer;
|
$customer = \WC()->customer;
|
||||||
if ( is_a( $customer, \WC_Customer::class ) ) {
|
$needs_shipping = false;
|
||||||
|
foreach ( $items as $item) {
|
||||||
|
if ( $item->category() !== Item::DIGITAL_GOODS ) {
|
||||||
|
$needs_shipping = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ( $needs_shipping && is_a( $customer, \WC_Customer::class ) ) {
|
||||||
$shipping = $this->shipping_factory->from_wc_customer( \WC()->customer );
|
$shipping = $this->shipping_factory->from_wc_customer( \WC()->customer );
|
||||||
if (
|
if (
|
||||||
! $shipping->address()->country_code()
|
! $shipping->address()->country_code()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue