From e83db4a10371520b8257a61a939c9d841560e4b0 Mon Sep 17 00:00:00 2001 From: Alex P Date: Thu, 14 Oct 2021 18:45:09 +0300 Subject: [PATCH] Save wc order after setting transaction id --- modules/ppcp-wc-gateway/src/Processor/OrderProcessor.php | 2 +- .../src/Processor/TransactionIdHandlingTrait.php | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/modules/ppcp-wc-gateway/src/Processor/OrderProcessor.php b/modules/ppcp-wc-gateway/src/Processor/OrderProcessor.php index dad27e0f7..78077747f 100644 --- a/modules/ppcp-wc-gateway/src/Processor/OrderProcessor.php +++ b/modules/ppcp-wc-gateway/src/Processor/OrderProcessor.php @@ -177,7 +177,7 @@ class OrderProcessor { $transaction_id = $this->get_paypal_order_transaction_id( $order ); if ( $transaction_id ) { - $this->set_order_transaction_id( $transaction_id, $wc_order ); + $this->update_transaction_id( $transaction_id, $wc_order ); } $this->handle_new_order_status( $order, $wc_order ); diff --git a/modules/ppcp-wc-gateway/src/Processor/TransactionIdHandlingTrait.php b/modules/ppcp-wc-gateway/src/Processor/TransactionIdHandlingTrait.php index 00efc2aac..76c16a977 100644 --- a/modules/ppcp-wc-gateway/src/Processor/TransactionIdHandlingTrait.php +++ b/modules/ppcp-wc-gateway/src/Processor/TransactionIdHandlingTrait.php @@ -28,13 +28,14 @@ trait TransactionIdHandlingTrait { * * @return bool */ - protected function set_order_transaction_id( + protected function update_transaction_id( string $transaction_id, WC_Order $wc_order, LoggerInterface $logger = null ): bool { try { $wc_order->set_transaction_id( $transaction_id ); + $wc_order->save(); return true; } catch ( Exception $exception ) { if ( $logger ) {