Skip to content

Commit f00fd50

Browse files
committed
Fix tests
1 parent 4bb7a21 commit f00fd50

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

classes/Hook/HookActionProductCancel.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,12 @@ public function run()
5757
// Display GA refund product
5858
$orderDetail = new OrderDetail($this->params['id_order_detail']);
5959

60+
// Check if the hook provided us with a valid existing ID of order detail.
61+
// An example are automatic tests, which do not provide it unfortunately.
62+
if (!Validate::isLoadedObject($orderDetail)) {
63+
return;
64+
}
65+
6066
$idProduct = empty($orderDetail->product_attribute_id) ? $orderDetail->product_id : $orderDetail->product_id . '-' . $orderDetail->product_attribute_id;
6167
if ((bool) Configuration::get('GA_V4_ENABLED')) {
6268
$js = $this->getGoogleAnalytics4(

0 commit comments

Comments
 (0)