Skip to content

Commit e168950

Browse files
jacobarriolakidunot89
authored andcommitted
Transactions: get customer id from correct location
The customer id is stored in the the session_handler instance. As a result the same transient was getting set for all users, which was causing errors when a hanging transaction was left.
1 parent 121a651 commit e168950

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

includes/utils/class-session-transaction-manager.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ public function next_transaction() {
169169
*/
170170
public function get_transaction_queue() {
171171
// Get transaction queue.
172-
$transaction_queue = get_transient( "woo_session_transactions_queue_{$this->_customer_id}" );
172+
$transaction_queue = get_transient( "woo_session_transactions_queue_{$this->session_handler->get_customer_id()}" );
173173
if ( ! $transaction_queue ) {
174174
$transaction_queue = array();
175175
}
@@ -199,7 +199,7 @@ public function pop_transaction_id() {
199199
}
200200

201201
// Get transaction queue.
202-
$transaction_queue = get_transient( "woo_session_transactions_queue_{$this->_customer_id}" );
202+
$transaction_queue = get_transient( "woo_session_transactions_queue_{$this->session_handler->get_customer_id()}" );
203203

204204
// Throw if transaction ID not on top.
205205
if ( $this->transaction_id !== $transaction_queue[0]['transaction_id'] ) {
@@ -221,11 +221,11 @@ public function pop_transaction_id() {
221221
public function save_transaction_queue( $queue = array() ) {
222222
// If queue empty delete transient and bail.
223223
if ( empty( $queue ) ) {
224-
delete_transient( "woo_session_transactions_queue_{$this->_customer_id}" );
224+
delete_transient( "woo_session_transactions_queue_{$this->session_handler->get_customer_id()}" );
225225
return;
226226
}
227227

228228
// Save transaction queue.
229-
set_transient( "woo_session_transactions_queue_{$this->_customer_id}", $queue );
229+
set_transient( "woo_session_transactions_queue_{$this->session_handler->get_customer_id()}", $queue );
230230
}
231231
}

0 commit comments

Comments
 (0)