WC_Gateway_Paypal_Response::payment_complete()protectedWC 1.0

Complete order, add transaction ID and note.

Метод класса: WC_Gateway_Paypal_Response{}

Хуков нет.

Возвращает

null. Ничего (null).

Использование

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->payment_complete( $order, $txn_id, $note );
$order(WC_Order) (обязательный)
Order object.
$txn_id(строка)
Transaction ID.
По умолчанию: ''
$note(строка)
Payment note.
По умолчанию: ''

Код WC_Gateway_Paypal_Response::payment_complete() WC 8.7.0

protected function payment_complete( $order, $txn_id = '', $note = '' ) {
	if ( ! $order->has_status( array( 'processing', 'completed' ) ) ) {
		$order->add_order_note( $note );
		$order->payment_complete( $txn_id );

		if ( isset( WC()->cart ) ) {
			WC()->cart->empty_cart();
		}
	}
}