WC_Gateway_Paypal_Response::payment_complete
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 Gateway Paypal Response::payment complete WC 11.2.2
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();
}
}
}