From 65f2ee0f49f5e9dc9a2484aecd7f57df887333f0 Mon Sep 17 00:00:00 2001 From: Mike Jolley Date: Fri, 27 Oct 2017 17:30:33 +0100 Subject: [PATCH] Cart totals: don't add shipping unless show_shipping is true. Closes #17412 --- includes/class-wc-cart-totals.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/includes/class-wc-cart-totals.php b/includes/class-wc-cart-totals.php index a9a5e0e01b9..d37fccf04d9 100644 --- a/includes/class-wc-cart-totals.php +++ b/includes/class-wc-cart-totals.php @@ -338,6 +338,10 @@ final class WC_Cart_Totals { protected function get_shipping_from_cart() { $this->shipping = array(); + if ( ! $this->cart->show_shipping() ) { + return; + } + foreach ( $this->cart->calculate_shipping() as $key => $shipping_object ) { $shipping_line = $this->get_default_shipping_props(); $shipping_line->object = $shipping_object;