Skip to content

Commit

Permalink
Express Checkout - No Shipping Required Adjustment Necessary #928
Browse files Browse the repository at this point in the history
  • Loading branch information
kcppdevelopers committed Nov 14, 2017
1 parent 02f7a53 commit 95f9d2a
Showing 1 changed file with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -113,16 +113,25 @@ public function angelleye_ec_save_payment_method_checkbox() {
}

public function angelleye_paypal_for_woocommerce_needs_shipping($SECFields) {
$is_required = 0;
$is_not_required = 0;
if (sizeof(WC()->cart->get_cart()) != 0) {
foreach ( WC()->cart->get_cart() as $cart_item_key => $cart_item ) {
$product_id = apply_filters( 'woocommerce_cart_item_product_id', $cart_item['product_id'], $cart_item, $cart_item_key );
$_no_shipping_required = get_post_meta($product_id, '_no_shipping_required', true);
if( $_no_shipping_required == 'yes' ) {
$SECFields['noshipping'] = 1;
return $SECFields;
$is_not_required = $is_not_required + 1;
} else {
$is_required = $is_required + 1;
}
}
}
if( $is_required > 0 ) {
return $SECFields;
} elseif ($is_not_required > 0) {
$SECFields['noshipping'] = 1;
return $SECFields;
}
return $SECFields;
}

Expand Down

0 comments on commit 95f9d2a

Please sign in to comment.