magento / inventory

Magento Inventory Project (a.k.a MSI)
Open Software License 3.0
337 stars 248 forks source link

Cannot invoice orders which contain bundle products comprised of physical and virtual products #3172

Open iosos-excel opened 4 years ago

iosos-excel commented 4 years ago

Preconditions (*)

  1. Magento 2.3.5-p2, 2.4.0
  2. Magento Inventory is enabled

Steps to reproduce (*)

  1. In the admin, create a sample physical product (This item has weight)

  2. Create a sample virtual product (This item has no weight)

  3. Create a sample bundle product

    • Set "Dynamic Price" to "No"
    • In "Bundle Items" add 2 options
      • Assign the sample physical product to option 1
      • Assign the sample virtual product to option 2 image
  4. In the front-end, add the sample bundle product to cart

  5. Check out using any payment method

  6. Back in the admin, invoice the sample order

Expected result (*)

  1. Order is successfully invoiced

Actual result (*)

  1. Browser displays a 500 error
  2. The order is not invoiced
  3. The Apache error log contains the following:
    PHP Fatal error: Uncaught TypeError: Return value of Magento\InventorySourceSelection\Model\Request\InventoryRequest::getItems() must be of the type array, null returned in /www/vendor/magento/module-inventory-source-selection/Model/Request/InventoryRequest.php:102
    Stack trace:
    #0 /www/vendor/magento/module-inventory-source-selection-api/Model/Algorithms/Result/GetDefaultSortedSourcesResult.php(97): Magento\InventorySourceSelection\Model\Request\InventoryRequest->getItems()
    magento/magento2#1 /www/vendor/magento/module-inventory-source-selection/Model/Algorithms/PriorityBasedAlgorithm.php(73): Magento\InventorySourceSelectionApi\Model\Algorithms\Result\GetDefaultSortedSourcesResult->execute(Object(Magento\InventorySourceSelection\Model\Request\InventoryRequest), Array)
    magento/magento2#2 /www/vendor/magento/module-inventory-source-selection-api/Model/SourceSelectionService.php(61) in /www/vendor/magento/module-inventory-source-selection/Model/Request/InventoryRequest.php on line 102

Notice: Issue is not reproducible on 2.4-develop

Additional information

m2-assistant[bot] commented 4 years ago

Hi @iosos-excel. Thank you for your report. To help us process this issue please make sure that you provided the following information:

Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:

@magento give me 2.4-develop instance - upcoming 2.4.x release

For more details, please, review the Magento Contributor Assistant documentation.

@iosos-excel do you confirm that you were able to reproduce the issue on vanilla Magento instance following steps to reproduce?


iosos-excel commented 4 years ago

@magento give me 2.3.4 instance

magento-engcom-team commented 4 years ago

Hi @iosos-excel. Thank you for your request. I'm working on Magento 2.3.4 instance for you

magento-engcom-team commented 4 years ago

Hi @iosos-excel, here is your Magento instance. Admin access: https://i-27144-2-3-4.instances.magento-community.engineering/admin_eee7 Login: 840f8935 Password: 076d19a5b913 Instance will be terminated in up to 3 hours.

iosos-excel commented 4 years ago

I cannot reproduce the issue in the Magento instance provided. However, the instance is missing the entire inventory source system, which is where the error seems to occur according to the logs. If I install a totally fresh/vanilla Magento 2.3.4 on my machine the inventory system is present and the issue is reproducible.

m2-assistant[bot] commented 4 years ago

Hi @engcom-Delta. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:

Renu05 commented 4 years ago

Hi @iosos-excel ,

I have tested in Vanilla Magento 2.3.4 . I am able to reproduce the above said error.

Steps Followed : I have added bundle product in cart which contains both virtual product and simple product and dynamic price is set to No. After successful order place when i am trying to create a invoice for this order i am getting the error.

Got Following error :

Fatal error: Uncaught TypeError: Return value of Magento\InventorySourceSelection\Model\Request\InventoryRequest::getItems() must be of the type array, null returned in /var/www/html/magento234ee/vendor/magento/module-inventory-source-selection/Model/Request/InventoryRequest.php:102 Stack trace: #0 /var/www/html/magento234ee/vendor/magento/module-inventory-source-selection-api/Model/Algorithms/Result/GetDefaultSortedSourcesResult.php(97): Magento\InventorySourceSelection\Model\Request\InventoryRequest->getItems() magento/magento2#1 /var/www/html/magento234ee/vendor/magento/module-inventory-source-selection/Model/Algorithms/PriorityBasedAlgorithm.php(73): Magento\InventorySourceSelectionApi\Model\Algorithms\Result\GetDefaultSortedSourcesResult->execute(Object(Magento\InventorySourceSelection\Model\Request\InventoryRequest), Array) magento/magento2#2 /var/www/html/magento234ee/vendor/magento/module-inventory-source-selection-api/Model/SourceSelectionService.php(61): Magento\InventorySourceSelection\Model\Algorithms\PriorityBasedAlgorithm->execute(Object(M in /var/www/html/magento234ee/vendor/magento/module-inventory-source-selection/Model/Request/InventoryRequest.php on line 102

sdzhepa commented 4 years ago

Due to the description and discussion under This issue seems related to Magento Inventory Project (a.k.a MSI) Transfer this issue into https://github.com/magento/inventory/issues

m2-assistant[bot] commented 4 years ago

Hi @iosos-excel. Thank you for your report. To help us process this issue please make sure that you provided sufficient information.

Please, add a comment to assign the issue: @magento I am working on this


ahsan-horani-reviver commented 4 years ago

Is there any update on this issue? I am still facing this issue in Magento 2.3.2 @sdzhepa @magento-engcom-team

ahsan-horani-reviver commented 4 years ago

Finally addressed this issue. Solution: https://magento.stackexchange.com/a/324163/21432