From 59c51fbebe9450d366a0759113c53769b87ae25a Mon Sep 17 00:00:00 2001 From: Mike Jolley Date: Fri, 22 Mar 2019 11:44:27 +0000 Subject: [PATCH] Only clear persistent cart if persistent cart is enabled --- includes/class-wc-cart-session.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/class-wc-cart-session.php b/includes/class-wc-cart-session.php index 960d023d200..7bdbacfcf14 100644 --- a/includes/class-wc-cart-session.php +++ b/includes/class-wc-cart-session.php @@ -253,7 +253,7 @@ final class WC_Cart_Session { * Delete the persistent cart permanently. */ public function persistent_cart_destroy() { - if ( get_current_user_id() ) { + if ( get_current_user_id() && apply_filters( 'woocommerce_persistent_cart_enabled', true ) ) { delete_user_meta( get_current_user_id(), '_woocommerce_persistent_cart_' . get_current_blog_id() ); } }