Skip to content

Products with custom options with custom SKUs can not be added to an order in the backend #43

@norgeindian

Description

@norgeindian

Preconditions

  • Magento version: 2.4.5-p2
  • Module version: 1.3.2

Settings / Sale Rules

Steps to reproduce

  1. Create a product and add a custom option to it, which has a custom SKU
  2. This SKU is usually added to the product SKU as soon as the product is added to a cart (Magento Core behavior)
  3. Now try to create an admin order and add your product to it

Expected result

  1. The product is properly added to the admin order

Actual result

  1. An error message appears, that the product can not be found.

To be honest, I did not really understand, how the module is included in this issue, but the error is gone as soon as I disable the module.
The failing call stack is the following:

ProductRepository.php:290, Magento\Catalog\Model\ProductRepository->get()
Interceptor.php:58, Magento\Catalog\Model\ProductRepository\Interceptor->___callParent()
Interceptor.php:138, Magento\Catalog\Model\ProductRepository\Interceptor->Magento\Framework\Interception\{closure:/var/www/html/vendor/magento/framework/Interception/Interceptor.php:104-151}()
Interceptor.php:153, Magento\Catalog\Model\ProductRepository\Interceptor->___callPlugins()
Interceptor.php:23, Magento\Catalog\Model\ProductRepository\Interceptor->get()
CartItemPersister.php:96, Magento\Quote\Model\Quote\Item\CartItemPersister->save()
SaveHandler.php:97, Magento\Quote\Model\QuoteRepository\SaveHandler->save()
Interceptor.php:23, Magento\Quote\Model\QuoteRepository\SaveHandler\Interceptor->save()
QuoteRepository.php:202, Magento\Quote\Model\QuoteRepository->save()
Interceptor.php:58, Magento\Quote\Model\QuoteRepository\Interceptor->___callParent()
Interceptor.php:138, Magento\Quote\Model\QuoteRepository\Interceptor->Magento\Framework\Interception\{closure:/var/www/html/vendor/magento/framework/Interception/Interceptor.php:104-151}()
CartSave.php:58, Fooman\Totals\Plugin\CartSave->aroundSave()
Interceptor.php:135, Magento\Quote\Model\QuoteRepository\Interceptor->Magento\Framework\Interception\{closure:/var/www/html/vendor/magento/framework/Interception/Interceptor.php:104-151}()
Interceptor.php:153, Magento\Quote\Model\QuoteRepository\Interceptor->___callPlugins()
Interceptor.php:59, Magento\Quote\Model\QuoteRepository\Interceptor->save()
Create.php:474, Magento\Sales\Model\AdminOrder\Create->saveQuote()
Interceptor.php:68, Magento\Sales\Model\AdminOrder\Create\Interceptor->saveQuote()
Create.php:283, Magento\Sales\Controller\Adminhtml\Order\Create->_processActionData()
Create.php:142, Magento\Sales\Controller\Adminhtml\Order\Create->_processData()
LoadBlock.php:58, Magento\Sales\Controller\Adminhtml\Order\Create\LoadBlock->execute()
Interceptor.php:58, Magento\Sales\Controller\Adminhtml\Order\Create\LoadBlock\Interceptor->___callParent()
Interceptor.php:138, Magento\Sales\Controller\Adminhtml\Order\Create\LoadBlock\Interceptor->Magento\Framework\Interception\{closure:/var/www/html/vendor/magento/framework/Interception/Interceptor.php:104-151}()
Interceptor.php:153, Magento\Sales\Controller\Adminhtml\Order\Create\LoadBlock\Interceptor->___callPlugins()
Interceptor.php:23, Magento\Sales\Controller\Adminhtml\Order\Create\LoadBlock\Interceptor->execute()
Action.php:111, Magento\Framework\App\Action\Action->dispatch()
AbstractAction.php:151, Magento\Backend\App\AbstractAction->dispatch()
Interceptor.php:58, Magento\Sales\Controller\Adminhtml\Order\Create\LoadBlock\Interceptor->___callParent()
Interceptor.php:138, Magento\Sales\Controller\Adminhtml\Order\Create\LoadBlock\Interceptor->Magento\Framework\Interception\{closure:/var/www/html/vendor/magento/framework/Interception/Interceptor.php:104-151}()
Authentication.php:145, Magento\Backend\App\Action\Plugin\Authentication->aroundDispatch()
Interceptor.php:135, Magento\Sales\Controller\Adminhtml\Order\Create\LoadBlock\Interceptor->Magento\Framework\Interception\{closure:/var/www/html/vendor/magento/framework/Interception/Interceptor.php:104-151}()
Interceptor.php:153, Magento\Sales\Controller\Adminhtml\Order\Create\LoadBlock\Interceptor->___callPlugins()
Interceptor.php:32, Magento\Sales\Controller\Adminhtml\Order\Create\LoadBlock\Interceptor->dispatch()
FrontController.php:245, Magento\Framework\App\FrontController->getActionResponse()
FrontController.php:212, Magento\Framework\App\FrontController->processRequest()
FrontController.php:147, Magento\Framework\App\FrontController->dispatch()
Interceptor.php:58, Magento\Framework\App\FrontController\Interceptor->___callParent()
Interceptor.php:138, Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure:/var/www/html/vendor/magento/framework/Interception/Interceptor.php:104-151}()
FrontController.php:81, Ess\M2ePro\Plugin\HealthStatus\Magento\Framework\App\FrontController->processDispatch()
AbstractPlugin.php:45, Ess\M2ePro\Plugin\AbstractPlugin->execute()
FrontController.php:45, Ess\M2ePro\Plugin\HealthStatus\Magento\Framework\App\FrontController->aroundDispatch()
Interceptor.php:135, Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure:/var/www/html/vendor/magento/framework/Interception/Interceptor.php:104-151}()
Interceptor.php:153, Magento\Framework\App\FrontController\Interceptor->___callPlugins()
Interceptor.php:23, Magento\Framework\App\FrontController\Interceptor->dispatch()
Http.php:116, Magento\Framework\App\Http->launch()
Interceptor.php:23, Magento\Framework\App\Http\Interceptor->launch()
Bootstrap.php:264, Magento\Framework\App\Bootstrap->run()
index.php:30, {main}()

The error comes, as the product repository tries to load the product by the joined SKU, which does not exist.
In a clean Magento Instance without the module, the callstack is a bit different, as $quote->getItems() returns false in \Magento\Quote\Model\QuoteRepository\SaveHandler::save.
I did not check that in detail now, but I assume the items are somehow initialized too early with the module?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions