I am using the following code in a plugin's aroundGetItemData() method.


It's returning me the following error,

Fatal error: Uncaught Error: Call to a member function getName() on null in /vendor/magento/module-configurable-product/Model/Product/Type/Configurable.php:992 Stack trace: #0 /generated/code/Magento/ConfigurableProduct/Model/Product/Type/Configurable/Interceptor.php(310):

When I investigated, I found that some of the selected attributes are not valid for this product as the simple products as out of stock.

How to handle this error? Any help will be greatly appreciated.

  • Have you get data in $product? Nov 12, 2019 at 11:27
  • Yes, I'm getting data in the product object. Nov 12, 2019 at 11:37
  • Open /vendor/magento/module-configurable-product/Model/Product/Type/Configurable.php file and see in getOrderOptions function $product->getCustomOption('simple_product') getting or not. Nov 12, 2019 at 11:52


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.