Warning: count(): Parameter must be an array or an object that implements Countable…

php warning

This is the fix for those who are using the Journal theme on OpenCart 3.x and receive PHP error on mobile devices. The full error goes like this:

Warning: count(): Parameter must be an array or an object that implements Countable in /home/usernamefolder/public_html/system/library/template/Twig/Node/Module.php on line 346

At the time of this error I was using OpenCart version 3.0.3.3 and Journal theme 3.0.46. This is the solution that fixed the error for me.
Open the Module.php file and modify the line 346 with a comment and add the next line beneath it:


#if (!count($node)) {
if (is_null($node)) {

That’s it. Small fix heals huge headaches.

Published
Categorized as OpenCart

By janoshke

Web developer and IT consultant. Freelancer with full respect for OpenCart and WordPress. Gamer, (ex)drummer and parent.

Leave a Reply