From ead5f208fa968e103c0b51d8282d2d35788f5e10 Mon Sep 17 00:00:00 2001 From: Gustaf Folin Date: Mon, 10 Jul 2017 12:13:38 +0200 Subject: [PATCH] Add hook around empty_cart() --- includes/class-wc-form-handler.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/includes/class-wc-form-handler.php b/includes/class-wc-form-handler.php index c555f6b9495..abc0a83170e 100644 --- a/includes/class-wc-form-handler.php +++ b/includes/class-wc-form-handler.php @@ -556,8 +556,9 @@ class WC_Form_Handler { return; } - // Clear current cart - WC()->cart->empty_cart(); + if ( apply_filters( 'woocommerce_empty_cart_when_order_again', true ) ) { + WC()->cart->empty_cart(); + } // Load the previous order - Stop if the order does not exist $order = wc_get_order( absint( $_GET['order_again'] ) );