WC_Gateway_Paypal_Response::payment_completeprotectedWC 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 9.9.3

protected function payment_complete( $order, $txn_id = '', $note = '' ) {
	if ( ! $order->has_status( array( OrderStatus::PROCESSING, OrderStatus::COMPLETED ) ) ) {
		$order->add_order_note( $note );
		$order->payment_complete( $txn_id );

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