Question

Uncaught Error: Call to a member function provide() on null in /vendor/magento/module-swatches/Helper/Data.php:350

I'm using Magento 2.1.8 with the Ethan theme from MGS. When I added swatches to configurable product and view the catalog this error appears and breaks the layout/styling of the page.

The single view page for the product doesn't load anything and display white screen.

I've looked all over for a solution, has anyone experienced this before?

Is there a fix?

Was it helpful?

Solution

I was only able to fix this with a core hack.

Above:

$swatchAttributes = $this->swatchAttributesProvider->provide($product);

Put this:

if (!isset($this->swatchAttributesProvider)) { $this->swatchAttributesProvider = ObjectManager::getInstance()->get(SwatchAttributesProvider::class); }

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top