check if *all* cart items are virtual

This commit is contained in:
cryptochangements34 2018-04-20 17:52:03 -04:00 committed by GitHub
parent 380cd24527
commit fa9d6b7162
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -318,15 +318,22 @@ class Monero_Gateway extends WC_Payment_Gateway
{
$order = wc_get_order( $order_id );
$items = $order->get_items();
$cart_size = count($items);
$virtual_items = 0;
foreach ( $items as $item ) {
$product = new WC_Product( $item['product_id'] );
if ( $product->is_virtual() ) {
return true;
$virtual_items += 1;
}
}
return false;
if($virtual_items == $cart_size)
{
return true;
}
else{
return false;
}
}
public function instruction($order_id)