From 307f44de882d1ec954a0310469f8a3cc78348a62 Mon Sep 17 00:00:00 2001
From: Reinhold Kainhofer <reinhold@kainhofer.com>
Date: Sun, 2 Apr 2017 16:51:04 +0200
Subject: [PATCH] WC3 compatibility: Change all order property extractions to
 use the proper getter functions (works in WC 2.6, too).

---
 includes/rules_shipping_framework_woocommerce.php | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/includes/rules_shipping_framework_woocommerce.php b/includes/rules_shipping_framework_woocommerce.php
index 2f4f4d3..d233928 100644
--- a/includes/rules_shipping_framework_woocommerce.php
+++ b/includes/rules_shipping_framework_woocommerce.php
@@ -150,9 +150,9 @@ class RulesShippingFrameworkWooCommerce extends RulesShippingFramework {
 		);
 		foreach ($products as $product) {
 	
-			$l = $product['data']->length;
-			$w = $product['data']->width;
-			$h = $product['data']->height;
+			$l = $product['data']->get_length();
+			$w = $product['data']->get_width();
+			$h = $product['data']->get_height();
 
 			$volume = $l * $w * $h;
 			$dimensions['volume'] += $volume * $product['quantity'];
@@ -193,7 +193,7 @@ class RulesShippingFrameworkWooCommerce extends RulesShippingFramework {
 		$tags = array();
 		$shipping_classes = array();
 		foreach ($products as $product) {
-			$id = $product['data']->id;
+			$id = $product['data']->get_id();
 			if ($product['data']->get_sku()) {
 				$skus[] = $product['data']->get_sku();
 			}
@@ -249,7 +249,7 @@ class RulesShippingFrameworkWooCommerce extends RulesShippingFramework {
 			$vendorids = array();
 			// The plugin provides its own function to retrieve the vendor for a product
 			foreach ($products as $product) {
-				foreach (get_product_vendors($product['data']->id) as $vendor) {
+				foreach (get_product_vendors($product['data']->get_id()) as $vendor) {
 // $this->printWarning("<pre>vendor: ".print_r($vendor,1)."</pre>");
 					$vendors[] = $vendor->slug;
 					$vendornames[] = $vendor->title;
@@ -268,7 +268,7 @@ class RulesShippingFrameworkWooCommerce extends RulesShippingFramework {
 			$vendorids = array();
 			// The plugin provides its own function to retrieve the vendor for a product
 			foreach ($products as $product) {
-				$vendor = yith_get_vendor($product['data']->id, 'product');
+				$vendor = yith_get_vendor($product['data']->get_id(), 'product');
 // $this->printWarning("<pre>vendor: ".print_r($vendor,1)."</pre>");
 				if ($vendor->is_valid()) {
 					$vendors[] = $vendor->slug;
-- 
GitLab