From 26c612c8446ee630b71aa6559c703366481a981c Mon Sep 17 00:00:00 2001 From: ebelrose Date: Thu, 21 Apr 2016 11:03:32 -0400 Subject: [PATCH] Resolving issue #16 https://github.com/hyyan/woo-poly-integration/issues/16 --- src/Hyyan/WPI/Order.php | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/Hyyan/WPI/Order.php b/src/Hyyan/WPI/Order.php index df367d8..e737226 100644 --- a/src/Hyyan/WPI/Order.php +++ b/src/Hyyan/WPI/Order.php @@ -102,7 +102,11 @@ public function saveOrderLanguage($order) */ public function translateProductsInOrdersDetails($product) { - return Utilities::getProductTranslationByObject($product); + if($product){ + return Utilities::getProductTranslationByObject($product); + }else{ + return false; + } } /** @@ -120,10 +124,14 @@ public function translateProductNameInOrdersDetails($name, $item) { $id = $item['item_meta']['_product_id'][0]; $product = Utilities::getProductTranslationByID($id); - if (!$product->is_visible()) { - return $product->post->post_title; - } else { - return sprintf('%s', get_permalink($product->id), $product->post->post_title); + if($product){ + if (!$product->is_visible()) { + return $product->post->post_title; + } else { + return sprintf('%s', get_permalink($product->id), $product->post->post_title); + } + }else{ + return $name; } }