Fix warning: Attempt to read property "order_awaiting_payment" on null (#45821)
This commit is contained in:
parent
d5dcf91ee2
commit
9fbf143df9
|
@ -0,0 +1,4 @@
|
|||
Significance: patch
|
||||
Type: fix
|
||||
|
||||
Check if there's an actual session available inside wc_clear_cart_after_payment
|
|
@ -184,7 +184,7 @@ function wc_clear_cart_after_payment() {
|
|||
}
|
||||
}
|
||||
|
||||
if ( WC()->session->order_awaiting_payment > 0 ) {
|
||||
if ( is_object( WC()->session ) && WC()->session->order_awaiting_payment > 0 ) {
|
||||
$order = wc_get_order( WC()->session->order_awaiting_payment );
|
||||
|
||||
if ( $order instanceof WC_Order && $order->get_id() > 0 ) {
|
||||
|
|
Loading…
Reference in New Issue