Skip to content

Commit

Permalink
Merge pull request woocommerce#15015 from woocommerce/fix/14973
Browse files Browse the repository at this point in the history
Check we have a valid order in wc_get_payment_gateway_by_order
  • Loading branch information
claudiosanches authored May 10, 2017
2 parents 1f11f1c + 7c82087 commit 44c20f4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion includes/wc-order-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

/**
Expand Down

0 comments on commit 44c20f4

Please sign in to comment.