From f5212e63bd41fb1595dba713b1a4e806a9972454 Mon Sep 17 00:00:00 2001 From: qfrery Date: Thu, 3 Dec 2015 17:03:49 +0100 Subject: [PATCH] Get rid of php errors PHP Notice: Trying to get property of non-object in /wp-content/plugins/segmentio/integrations/ecommerce/woocommerce.php on line 296 PHP Notice: Trying to get property of non-object in /wp-content/plugins/segmentio/integrations/ecommerce/woocommerce.php on line 301 --- integrations/ecommerce/woocommerce.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/integrations/ecommerce/woocommerce.php b/integrations/ecommerce/woocommerce.php index 52ffcdb..e9ad863 100644 --- a/integrations/ecommerce/woocommerce.php +++ b/integrations/ecommerce/woocommerce.php @@ -293,12 +293,12 @@ public function completed_order() { foreach ( $items as $item ) { $_product = $order->get_product_from_item( $item ); $product = array( - 'id' => $item->product_id, + 'id' => $item['product_id'], 'sku' => $_product->get_sku(), 'name' => $item['name'], 'price' => $item['line_subtotal'], 'quantity' => $item['qty'], - 'category' => implode( ', ', wp_list_pluck( wc_get_product_terms( $item->product_id, 'product_cat' ), 'name' ) ), + 'category' => implode( ', ', wp_list_pluck( wc_get_product_terms( $item['product_id'], 'product_cat' ), 'name' ) ), ); $products[] = $product; @@ -336,4 +336,4 @@ function segment_commerce_woo() { return $commerce->init(); } -add_action( 'plugins_loaded', 'segment_commerce_woo', 100 ); \ No newline at end of file +add_action( 'plugins_loaded', 'segment_commerce_woo', 100 );