Cart totals: don't add shipping unless show_shipping is true.

Closes #17412
This commit is contained in:
Mike Jolley 2017-10-27 17:30:33 +01:00
parent 75d390e2a9
commit 65f2ee0f49
1 changed files with 4 additions and 0 deletions

View File

@ -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;