0

I am facing error like,

TypeError: Magento\Catalog\Pricing\Price\CalculateCustomOptionCatalogRule::execute(): Argument #1 ($product) must be of type Magento\Catalog\Model\Product, null given, called in /var/www/html/mag244/vendor/magento/module-catalog/Model/Product/Option/Value.php on line 270 and defined in /var/www/html/mag244/vendor/magento/module-catalog/Pricing/Price/CalculateCustomOptionCatalogRule.php:49

Please check this,

<script type="text/x-magento-init">
    {
        "#product_addtocart_form": {
            "priceOptions": {
                "optionConfig": TypeError: Magento\Catalog\Pricing\Price\CalculateCustomOptionCatalogRule::execute(): Argument #1 ($product) must be of type Magento\Catalog\Model\Product, null given, called in /var/www/html/mag244/vendor/magento/module-catalog/Model/Product/Option/Value.php on line 270 and defined in /var/www/html/mag244/vendor/magento/module-catalog/Pricing/Price/CalculateCustomOptionCatalogRule.php:49
Stack trace:
#0 /var/www/html/mag244/vendor/magento/module-catalog/Model/Product/Option/Value.php(270): Magento\Catalog\Pricing\Price\CalculateCustomOptionCatalogRule->execute()
#1 /var/www/html/mag244/generated/code/MageWorx/OptionBase/Model/Product/Option/Value/Interceptor.php(140): Magento\Catalog\Model\Product\Option\Value->getPrice()
#2 /var/www/html/mag244/vendor/magento/module-catalog/Block/Product/View/Options.php(171): MageWorx\OptionBase\Model\Product\Option\Value\Interceptor->getPrice()
#3 /var/www/html/mag244/vendor/magento/module-catalog/Block/Product/View/Options.php(227): Magento\Catalog\Block\Product\View\Options->_getPriceConfiguration()
#4 /var/www/html/mag244/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Catalog\Block\Product\View\Options->getJsonConfig()
#5 /var/www/html/mag244/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Catalog\Block\Product\View\Options\Interceptor->___callParent()
#6 /var/www/html/mag244/app/code/MageWorx/OptionAdvancedPricing/Plugin/ExtendPriceConfig.php(97): Magento\Catalog\Block\Product\View\Options\Interceptor->Magento\Framework\Interception\{closure}()
#7 /var/www/html/mag244/generated/code/MageWorx/OptionAdvancedPricing/Plugin/ExtendPriceConfig/Interceptor.php(23): MageWorx\OptionAdvancedPricing\Plugin\ExtendPriceConfig->aroundGetJsonConfig()
#8 /var/www/html/mag244/vendor/magento/framework/Interception/Interceptor.php(135): MageWorx\OptionAdvancedPricing\Plugin\ExtendPriceConfig\Interceptor->aroundGetJsonConfig()
#9 /var/www/html/mag244/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Catalog\Block\Product\View\Options\Interceptor->Magento\Framework\Interception\{closure}()
#10 /var/www/html/mag244/generated/code/Magento/Catalog/Block/Product/View/Options/Interceptor.php(68): Magento\Catalog\Block\Product\View\Options\Interceptor->___callPlugins()
#11 /var/www/html/mag244/vendor/magento/module-catalog/view/frontend/templates/product/view/options.phtml(17): Magento\Catalog\Block\Product\View\Options\Interceptor->getJsonConfig()
#12 /var/www/html/mag244/vendor/magento/framework/View/TemplateEngine/Php.php(71): include('...')
#13 /var/www/html/mag244/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Framework\View\TemplateEngine\Php->render()
#14 /var/www/html/mag244/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\View\TemplateEngine\Php\Interceptor->___callParent()
#15 /var/www/html/mag244/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Framework\View\TemplateEngine\Php\Interceptor->Magento\Framework\Interception\{closure}()
#16 /var/www/html/mag244/generated/code/Magento/Framework/View/TemplateEngine/Php/Interceptor.php(23): Magento\Framework\View\TemplateEngine\Php\Interceptor->___callPlugins()
#17 /var/www/html/mag244/vendor/magento/framework/View/Element/Template.php(263): Magento\Framework\View\TemplateEngine\Php\Interceptor->render()
#18 /var/www/html/mag244/generated/code/Magento/Catalog/Block/Product/View/Options/Interceptor.php(149): Magento\Framework\View\Element\Template->fetchView()
#19 /var/www/html/mag244/vendor/magento/framework/View/Element/Template.php(293): Magento\Catalog\Block\Product\View\Options\Interceptor->fetchView()
#20 /var/www/html/mag244/vendor/magento/framework/View/Element/AbstractBlock.php(1095): Magento\Framework\View\Element\Template->_toHtml()

Please help me!!!

Note: I have installed Mageworx custom option extension.

3 Answers 3

1

Try to apply this patch which published recently (18 October, 2022) by Magento:
https://github.com/magento/magento2/commit/a1aa4af82c39d8f0445eb8fcf023e7c2cf0bdade.diff

Reated commit: https://github.com/magento/magento2/commit/a1aa4af82c39d8f0445eb8fcf023e7c2cf0bdade

1
0

We are facing the same issue with the Mageworx module. Our Magento is 2.4.5.1.

Did you ask Mageworx for a fix? This shouldn't normally happen.

Can you explain to me if this patch was already incorporated in Magento 2.4.5.1? And what is causing the problem?

1
  • Please confirm that your module is compatible with the Magento 2.4.5. I don't know that Magento has released patch or not yet. But using this updated files my problem was solved. So you can install your own patch. Dec 7, 2022 at 5:24
0

After hours of researching the problem we found that the module has incompatibility with another module (OSC). We have reproduced the issue on a clean install M.2.4.5.1 We are concerned that the Patch will cause more problems in our store due to Mageworx module malfunction and incompatibility.

Can you tell me how this patch acts in magento to solve the problem?

1
  • The patch I mentioned fixed the issue from Magento code base and also fixed the issue Mageworx module which the Original Poster raised. This patch is already verified and included in Magento code base but has not been released yet, it will be included in the next release. So you can apply this patch with no concerns.
    – Tu Van
    Dec 14, 2022 at 9:42

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.