Check we have a valid order in wc_get_payment_gateway_by_order

Fixes #14973
This commit is contained in:
Mike Jolley 2017-05-10 19:54:20 +01:00
parent 75def72ff7
commit 7c82087bcd
1 changed files with 1 additions and 1 deletions

View File

@ -704,7 +704,7 @@ function wc_get_payment_gateway_by_order( $order ) {
$order = wc_get_order( $order_id );
}
return isset( $payment_gateways[ $order->get_payment_method() ] ) ? $payment_gateways[ $order->get_payment_method() ] : false;
return is_a( $order, 'WC_Order' ) && isset( $payment_gateways[ $order->get_payment_method() ] ) ? $payment_gateways[ $order->get_payment_method() ] : false;
}
/**