\Magento\InventoryShipping\Model\InventoryRequestFromOrderFactory not working for bundle products
- Dominant language
- PHP
- Stars
- 357
- Forks
- 262
- PR merge metrics
- No merged PRs in 30d
Description
### Preconditions (*)
1. Magento 2.4.3-p1
2. Inventory 1.2.1-p1
### Steps to reproduce (*)
1. Create a bundle product with one physical item and 2 virtual ones

3. Place an order with the bundle product
4. Make sure the order doesn't have any other type of product
5. Create a sample class
```
inventoryRequestFromOrderFactory = $inventoryRequestFromOrderFactory;
$this->sourceSelectionService = $sourceSelectionService;
parent::__construct($context);
}
public function getAlgorithmSourceCode()
{
return $this->scopeConfig->getValue('vendor/orders/source_selection_algorithm_code');
}
/**
* @param OrderInterface $order
* @return void
*/
public function getPreferredSource($order)
{
$inventoryRequest = $this->inventoryRequestFromOrderFactory->create($order);
$result = $this->sourceSelectionService->execute($inventoryRequest, $this->getAlgorithmSourceCode());
return $result;
}
}
```
However the same issue doesn't happen when you ship the order from the backend and everything works as expected.
### Expected result (*)
The `$inventoryRequest` contains the bundle SKU product
This is the sample inventory request created when shipping the product via the backend. As you can see it contains one product the physical one.


### Actual result (*)
1. The `$inventoryRequest` contains an empty items array

Contributor guide
Research direction
Start by reading Magento\InventoryShipping\Model\InventoryRequestFromOrderFactory and tracing the create($order) call shown in the SourceSelection sample. Reproduce the bundle-order case on Magento 2.4.3-p1 with Inventory 1.2.1-p1, compare the resulting request with backend shipping, and confirm that the request includes the physical bundle item rather than an empty items array.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100