0

I'm trying to use functions in \Magento\Swatches\Block\Product\Renderer\Listing\Configurable directly from my controller.

Ive created an instance like this :

$swatchInstance = $this->layoutFactory->create()->createBlock('\Magento\Swatches\Block\Product\Renderer\Listing\Configurable');

but when i try to use functions like

$swatchInstance->getJsonSwatchSizeConfig()

I am getting the error

Uncaught Error: Call to a member function getTypeInstance() on null

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.