Fix WC_Order::payment_complete() on back-end

SHA: c038001eab changed `WC_Abstract_Order::payment_complete()` to use
WC()->session->set( 'order_awaiting_payment' ) instead of
`WC()->session->order_awaiting_payment`, but `WC()->session` is only
set on front-end requests, meaning any extension that tries to complete
payment on an order from the back-end would cause a fatal error.
This commit is contained in:
Brent Shepherd 2015-02-10 16:55:47 -08:00
parent 3a4e9c0d7f
commit f1fa927f57
1 changed files with 3 additions and 1 deletions

View File

@ -2141,7 +2141,9 @@ abstract class WC_Abstract_Order {
do_action( 'woocommerce_pre_payment_complete', $this->id ); do_action( 'woocommerce_pre_payment_complete', $this->id );
WC()->session->set( 'order_awaiting_payment', false ); if ( null !== WC()->session ) {
WC()->session->set( 'order_awaiting_payment', false );
}
$valid_order_statuses = apply_filters( 'woocommerce_valid_order_statuses_for_payment_complete', array( 'on-hold', 'pending', 'failed', 'cancelled' ), $this ); $valid_order_statuses = apply_filters( 'woocommerce_valid_order_statuses_for_payment_complete', array( 'on-hold', 'pending', 'failed', 'cancelled' ), $this );