We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 2d46d02 + ff15bdf commit 9beb599Copy full SHA for 9beb599
1 file changed
classes/Hook/HookActionProductCancel.php
@@ -24,6 +24,7 @@
24
use Context;
25
use OrderDetail;
26
use Ps_Googleanalytics;
27
+use Validate;
28
29
class HookActionProductCancel implements HookInterface
30
{
@@ -57,6 +58,12 @@ public function run()
57
58
// Display GA refund product
59
$orderDetail = new OrderDetail($this->params['id_order_detail']);
60
61
+ // Check if the hook provided us with a valid existing ID of order detail.
62
+ // An example are automatic tests, which do not provide it unfortunately.
63
+ if (!Validate::isLoadedObject($orderDetail)) {
64
+ return;
65
+ }
66
+
67
$idProduct = empty($orderDetail->product_attribute_id) ? $orderDetail->product_id : $orderDetail->product_id . '-' . $orderDetail->product_attribute_id;
68
if ((bool) Configuration::get('GA_V4_ENABLED')) {
69
$js = $this->getGoogleAnalytics4(
0 commit comments