Skip to content

Commit e19e623

Browse files
committed
Revert "AC-15286::Order creation in backoffice with multiple products of which at least one contains custom options, leads to unwanted extra products to get added to the order"
This reverts commit 79418db.
1 parent 79418db commit e19e623

File tree

1 file changed

+5
-10
lines changed
  • app/code/Magento/Sales/Controller/Adminhtml/Order

1 file changed

+5
-10
lines changed

app/code/Magento/Sales/Controller/Adminhtml/Order/Create.php

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
use Magento\Framework\View\Result\PageFactory;
1616
use Magento\Backend\Model\View\Result\ForwardFactory;
1717
use Magento\Sales\Model\Order\Create\ValidateCoupon;
18-
use Magento\Catalog\Api\ProductRepositoryInterface;
18+
use Magento\Catalog\Api\ProductRepositoryInterface;
1919

2020
/**
2121
* Adminhtml sales orders creation process controller
@@ -61,7 +61,7 @@ abstract class Create extends \Magento\Backend\App\Action
6161
/**
6262
* @var ProductRepositoryInterface
6363
*/
64-
private ?ProductRepositoryInterface $productRepository = null;
64+
private ProductRepositoryInterface $productRepository;
6565

6666
/**
6767
* @param Context $context
@@ -86,7 +86,8 @@ public function __construct(
8686
$this->escaper = $escaper;
8787
$this->resultPageFactory = $resultPageFactory;
8888
$this->resultForwardFactory = $resultForwardFactory;
89-
$this->productRepository = $productRepository;
89+
$this->productRepository = $productRepository ?: ObjectManager::getInstance()
90+
->get(ProductRepositoryInterface::class);
9091
$this->validateCoupon = $validateCoupon ?: ObjectManager::getInstance()->get(ValidateCoupon::class);
9192
}
9293

@@ -294,13 +295,7 @@ function ($v) {
294295
if ($this->_getQuote()->hasProductId((int)$productId) && !$hasOptionsInConfig) {
295296
try {
296297
/** @var Product $product */
297-
$product = ($this->productRepository ?: ObjectManager::getInstance()
298-
->get(ProductRepositoryInterface::class))
299-
->getById(
300-
(int)$productId,
301-
false,
302-
(int)$this->_getOrderCreateModel()->getQuote()->getStoreId()
303-
);
298+
$product = $this->productRepository->getById($productId);
304299
if ($product->getId() && $product->getHasOptions()) {
305300
$hasRequired = false;
306301
foreach ($product->getOptions() as $option) {

0 commit comments

Comments
 (0)