Check if order exists while check if COD is available
This commit is contained in:
parent
f6b4614225
commit
3a629efc4b
|
@ -132,7 +132,7 @@ class WC_Gateway_COD extends WC_Payment_Gateway {
|
|||
$order = wc_get_order( $order_id );
|
||||
|
||||
// Test if order needs shipping.
|
||||
if ( 0 < count( $order->get_items() ) ) {
|
||||
if ( $order && 0 < count( $order->get_items() ) ) {
|
||||
foreach ( $order->get_items() as $item ) {
|
||||
$_product = $item->get_product();
|
||||
if ( $_product && $_product->needs_shipping() ) {
|
||||
|
|
Loading…
Reference in New Issue