From fcfbdbe1fa4891d1638ee648db139c425bec8616 Mon Sep 17 00:00:00 2001 From: Pedro Silva Date: Thu, 28 Sep 2023 15:14:19 +0100 Subject: [PATCH] Fix SimulateCart to prevent cart race conditions --- modules/ppcp-button/src/Endpoint/SimulateCartEndpoint.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/modules/ppcp-button/src/Endpoint/SimulateCartEndpoint.php b/modules/ppcp-button/src/Endpoint/SimulateCartEndpoint.php index 6862cc006..ed58eec06 100644 --- a/modules/ppcp-button/src/Endpoint/SimulateCartEndpoint.php +++ b/modules/ppcp-button/src/Endpoint/SimulateCartEndpoint.php @@ -159,9 +159,7 @@ class SimulateCartEndpoint extends AbstractCartEndpoint { $this->remove_cart_items(); // Restore cart and unset cart clone. - if ( null !== $this->real_cart ) { - WC()->cart = $this->real_cart; - } + unset( WC()->cart ); unset( $this->cart ); }