Check if product is NULL before passing to array_walk