Solved – Undefined Method in getConfigurableAttributeCollection in Magento 2.3.3
Losing a conversation at checkout is painful, owing to all the efforts you put in shaping the customer journey and reach till checkout.
Checkout page optimization can save you the bucks that you lose due to cart abandonment. Any errors on the checkout step can be fatal and one such checkout issue due to undefined method in getConfigurableAttributeCollection in Magento 2.3.3 is identified.
The customers won’t be able to redirect on the payment gateway in some cases due to the below error:
Uncaught exception ‘Error’ with message ‘Call to undefined method Magento\Catalog\Model\Product\Type\Simple::getConfigurableAttributeCollection()’ in /home/ortlieb/public_html/vendor/magento/module-configurable-product/Helper/Product/Options/Loader.php:52
Uncaught exception ‘Error’ with message ‘Call to undefined method Magento\Catalog\Model\Product\Type\Simple::getConfigurableAttributeCollection()’ in /home/ortlieb/public_html/vendor/magento/module-configurable-product/Helper/Product/Options/Loader.php:52 in Magento\ConfigurableProduct\Helper\Product\Options\Loader::load called at /home/ortlieb/public_html/vendor/magento/module-configurable-product/Model/Product/ReadHandler.php (48) in Magento\ConfigurableProduct\Model\Product\ReadHandler::execute called at /home/ortlieb/public_html/vendor/magento/framework/EntityManager/Operation/Read/ReadExtensions.php (48) in Magento\Framework\EntityManager\Operation\Read\ReadExtensions::execute called at /home/ortlieb/public_html/vendor/magento/framework/EntityManager/Operation/Read.php (112) in Magento\Framework\EntityManager\Operation\Read::execute called at /home/ortlieb/public_html/vendor/magento/framework/EntityManager/EntityManager.php (70) in Magento\Framework\EntityManager\EntityManager::load called at /home/ortlieb/public_html/vendor/magento/module-catalog/Model/ResourceModel/Product.php (648) in Magento\Catalog\Model\ResourceModel\Product::load called at /home/ortlieb/public_html/generated/code/Magento/Catalog/Model/ResourceModel/Product/Interceptor.php (258) in Magento\Catalog\Model\ResourceModel\Product\Interceptor::load called at /home/ortlieb/public_html/vendor/magento/framework/Model/AbstractModel.php (540) in Magento\Framework\Model\AbstractModel::load called at /home/ortlieb/public_html/vendor/magento/framework/Interception/Interceptor.php (58) in Magento\Catalog\Model\Product\Interceptor::___callParent called at /home/ortlieb/public_html/vendor/magento/framework/Interception/Interceptor.php (138) in Magento\Catalog\Model\Product\Interceptor::Magento\Framework\Interception{closure} called at /home/ortlieb/public_html/vendor/magento/framework/Interception/Interceptor.php (153) in Magento\Catalog\Model\Product\Interceptor::___callPlugins called at
If you face the same error, implement the below solution.
Solution to Undefined Method In getConfigurableAttributeCollection in Magento 2.3.3:
Add simple condition in Magento\ConfigurableProduct\Helper\Product\Options\Loader::load(ProductInterface $product) after line no : 51
1 2 3 4 |
if (get_class($typeInstance) == 'Magento\Catalog\Model\Product\Type\Simple' || get_class($typeInstance) == 'Magento\Bundle\Model\Product\Type') { return null; } |
That’s it.
Any doubts in the above solution can be mentioned in the Comments section below. I’d be happy to help.
Do share the solution with fellow developers via social media.
Thanks.
Sanjay Jethva
Sanjay is the co-founder and CTO of Meetanshi with hands-on expertise with Magento since 2011. He specializes in complex development, integrations, extensions, and customizations. Sanjay is one the top 50 contributor to the Magento community and is recognized by Adobe.
His passion for Magento 2 and Shopify solutions has made him a trusted source for businesses seeking to optimize their online stores. He loves sharing technical solutions related to Magento 2 & Shopify.
2 Comments
Hello
Thanks for your help !!!
I have tried to override this file but working can you give me any help?
Hello,
Can you put the log in that file and cache. Also, clear the cache after putting the log.
Thank you.