Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions classes/Hook/HookDisplayFooterProduct.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,14 @@ public function run()
return;
}

// The 'product' template variable is expected to be a ProductLazyArray (array-accessible).
// Some themes or modules assign a raw Product object instead, which prepareItemFromProduct()
// cannot consume (it accesses array keys) and would raise a fatal error on the product page.
// Skip tracking in that case rather than breaking the page.
if (!is_array($product) && !$product instanceof \ArrayAccess) {
return;
}

// Initialize tag handler
$gaTagHandler = new GanalyticsJsHandler($this->module, $this->context);

Expand Down
Loading