check if *all* cart items are virtual
This commit is contained in:
parent
380cd24527
commit
fa9d6b7162
@ -318,15 +318,22 @@ class Monero_Gateway extends WC_Payment_Gateway
|
|||||||
{
|
{
|
||||||
$order = wc_get_order( $order_id );
|
$order = wc_get_order( $order_id );
|
||||||
$items = $order->get_items();
|
$items = $order->get_items();
|
||||||
|
$cart_size = count($items);
|
||||||
|
$virtual_items = 0;
|
||||||
|
|
||||||
foreach ( $items as $item ) {
|
foreach ( $items as $item ) {
|
||||||
$product = new WC_Product( $item['product_id'] );
|
$product = new WC_Product( $item['product_id'] );
|
||||||
if ( $product->is_virtual() ) {
|
if ( $product->is_virtual() ) {
|
||||||
return true;
|
$virtual_items += 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if($virtual_items == $cart_size)
|
||||||
return false;
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function instruction($order_id)
|
public function instruction($order_id)
|
||||||
|
Loading…
Reference in New Issue
Block a user