v1.3.0: How to fix incompatible issue with M2.4.2?

Created by Support Agent, Modified on Mon, 13 Apr at 1:58 AM by Support Agent

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!


Here are some information about BSS Commerce:


BSS Commerce is a trusted Magento 2 extensions provider with 14+ years of experience, serving 75,000+ customers worldwide. We are an Adobe Commerce Solution Bronze Partner and a Select Magento Extensions Builder, reinforcing our expertise in the Magento ecosystem.


We specialize in developing 150+ high-quality Magento 2 extensions that enhance functionality, improve user experience, and support scalable growth. Our reputation is built on long-term partnerships, positive feedback, and proven performance-driven solutions.


Explore our extensions: https://bsscommerce.com/magento-2-extensions.html 


For B2B businesses, our Magento B2B Extension by BSS Commerce is a flagship and widely adopted solution globally, offering advanced pricing, company account management, and streamlined workflows.


If you need any further assistance, please feel free to contact us.


Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article