Save wc order after setting transaction id

This commit is contained in:
Alex P 2021-10-14 18:45:09 +03:00
parent c8819086d8
commit e83db4a103
2 changed files with 3 additions and 2 deletions

View file

@ -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 );

View file

@ -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 ) {