diff --git a/includes/rules_shipping_framework_woocommerce.php b/includes/rules_shipping_framework_woocommerce.php index 3199766d00c36db1fc087a9cf197a6a4f75583fa..fc01c1a25db5cd3a0c788d3ddfab99b2525aa975 100644 --- a/includes/rules_shipping_framework_woocommerce.php +++ b/includes/rules_shipping_framework_woocommerce.php @@ -152,20 +152,27 @@ class RulesShippingFrameworkWooCommerce extends RulesShippingFramework { $w = $product['data']->get_width(); $h = $product['data']->get_height(); - $volume = $l * $w * $h; - $dimensions['volume'] += $volume * $product['quantity']; - $dimensions['maxvolume'] = max ($dimensions['maxvolume'], $volume); - $dimensions['minvolume'] = min ($dimensions['minvolume'], $volume); - - $dimensions['totallength'] += $l * $product['quantity']; - $dimensions['maxlength'] = max ($dimensions['maxlength'], $l); - $dimensions['minlength'] = min ($dimensions['minlength'], $l); - $dimensions['totalwidth'] += $w * $product['quantity']; - $dimensions['maxwidth'] = max ($dimensions['maxwidth'], $w); - $dimensions['minwidth'] = min ($dimensions['minwidth'], $w); - $dimensions['totalheight'] += $h * $product['quantity']; - $dimensions['maxheight'] = max ($dimensions['maxheight'], $h); - $dimensions['minheight'] = min ($dimensions['minheight'], $h); + if (is_numeric($l) && is_numeric($w) && is_numeric($h)) { + $volume = $l * $w * $h; + $dimensions['volume'] += $volume * $product['quantity']; + $dimensions['maxvolume'] = max ($dimensions['maxvolume'], $volume); + $dimensions['minvolume'] = min ($dimensions['minvolume'], $volume); + } + if (is_numeric($l)) { + $dimensions['totallength'] += $l * $product['quantity']; + $dimensions['maxlength'] = max ($dimensions['maxlength'], $l); + $dimensions['minlength'] = min ($dimensions['minlength'], $l); + } + if (is_numeric($w)) { + $dimensions['totalwidth'] += $w * $product['quantity']; + $dimensions['maxwidth'] = max ($dimensions['maxwidth'], $w); + $dimensions['minwidth'] = min ($dimensions['minwidth'], $w); + } + if (is_numeric($h)) { + $dimensions['totalheight'] += $h * $product['quantity']; + $dimensions['maxheight'] = max ($dimensions['maxheight'], $h); + $dimensions['minheight'] = min ($dimensions['minheight'], $h); + } } return $dimensions; diff --git a/readme.txt b/readme.txt index 5b6af0cae79bec67df425d55bde8694543456da0..9c8bf4df3796996cd86daa903052bc19fcad861a 100644 --- a/readme.txt +++ b/readme.txt @@ -3,7 +3,7 @@ Contributors: opentools Tags: WooCommerce, Shipment, Shipping, Rules shipping Requires at least: 4.0 Tested up to: 4.8 -Stable tag: 2.0.1 +Stable tag: 2.0.2 License: GPLv3 or later License URI: http://www.gnu.org/licenses/gpl.html