From fa9d6b7162525f8b28ef7da01b3d33747ba67d7b Mon Sep 17 00:00:00 2001 From: cryptochangements34 Date: Fri, 20 Apr 2018 17:52:03 -0400 Subject: [PATCH] check if *all* cart items are virtual --- monero/include/monero_payments.php | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/monero/include/monero_payments.php b/monero/include/monero_payments.php index ae226b4..ab060eb 100644 --- a/monero/include/monero_payments.php +++ b/monero/include/monero_payments.php @@ -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)