QUESTION:


I use the module v1.3.0 on my site and it works fine. 

However, after I upgrading my site to Magento 2.4.2, when I open the product configurable, it shows error:


] main.CRITICAL: TypeError: Argument 1 passed to Magento\Catalog\Pricing\Price\CalculateCustomOptionCatalogRule::execute() must be an instance of Magento\Catalog\Model\Product, null given, called in /var/www/vhosts/lockstation.co.uk/htdocs/vendor/magento/module-catalog/Model/Product/Option/Value.php on line 270 and defined in /xxx/xxxx/xxxx/xxxx/xxxx/vendor/magento/module-catalog/Pricing/Price/CalculateCustomOptionCatalogRule.php:49
Stack trace:
#0 /var/xxx/xxx/xxx/xxxx/xxxx/vendor/magento/module-catalog/Model/Product/Option/Value.php(270): Magento\Catalog\Pricing\Price\CalculateCustomOptionCatalogRule->execute(NULL, 2, false)
#1 /var/xxxx/xxxx/xxxx/xxxx/xxxx/app/code/Bss/Simpledetailconfigurable/Observer/SetChildCustomOption.php(122): Magento\Catalog\Model\Product\Option\Value->getPrice(true)
#2 /var/xxx/xxxx/xxxx/xxxx/xxx/app/code/Bss/Simpledetailconfigurable/Observer/SetChildCustomOption.php(108): Bss\Simpledetailconfigurable\Observer\SetChildCustomOption->_getPriceConfiguration(Object(Magento\Catalog\Model\Product\Option\Value\Interceptor), Object(Magento\Catalog\Model\Product\Interceptor))
#3 /var/xxxx/xxxx/xxxx/xxxx/xxxx/app/code/Bss/Simpledetailconfigurable/Observer/SetChildCustomOption.php(88): Bss\Simpledetailconfigurable\Observer\SetChildCustomOption->getTmpPriceValues(Object(Magento\Catalog\Model\Product\Option\Interceptor), Object(Magento\Catalog\Model\Product\Interceptor))
#4 /var/xxxx/xxxx/xxxx/xxxx/xxxxx/vendor/magento/framework/Event/Invoker/InvokerDefault.php(88
)......


Please tell me how to fix it?


ANSWER:


To fix this error, please edit file app/code/Bss/Simpledetailconfigurable/Observer/SetChildCustomOption.php  as below:



Or download the file attached and override the current file on your site.


If you need any further assistance, please feel free to contact us. We'd be happy to support!