The Temando extension disabled can't fix the same problem for me. I found this variable $this->mapProviders is empty in /vendor/magento/module-catalog/Model/ProductLink/CollectionProvider.php file. This caused the problem. not sure what happened. I solved this problem by modifying the core magento file in /vendor/magento/module-catalog/Model/ProductLink/CollectionProvider.php. In getMap function, add this after if (!$types) {...}. So it'd be:
...
public function getMap(array $products, array $types): array
{
if (!$types) {
throw new \InvalidArgumentException('Types are required');
}
//FIX Warning: Invalid argument supplied for foreach() in /vendor/magento/module-catalog/Model/ProductLink/CollectionProvider.php on line 185
if (!(is_array($this->mapProviders))) {
$this->mapProviders = array(
ObjectManager::getInstance()->create(LinkedMapProvider::class)
);
}
...
}
...
You need to import a few files as well on the top of this file:
use Magento\Catalog\Model\ProductLink\CollectionProvider\LinkedMapProvider;
use Magento\Framework\App\ObjectManager;
I know this fix is not clean as magento way. let me know if there is a better fix.