Hello,
You are right, and thank you for the precise report. $categoryOptions is only created inside the loop, so a shop where no product belongs to a category leaves it undefined, and PHP 8 stops on the array_merge with exactly the message you quote.
It is fixed for the next release with the line you suggested:
$allCategoryOptions = array();
$categoryOptions = array();
Looking at the file we also corrected the filter itself: choosing a category which no longer holds any product produced c.product_id IN(), which the database refuses. It now matches nothing instead.
Glad the namespaced classes save you a patch, that change was made for the Joomla 6 support of 6.6.0.
You can download the install package of HikaShop on our website and install it on yours in order to get the patchs automatically.