magento / magento2

Prior to making any Submission(s), you must sign an Adobe Contributor License Agreement, available here at: https://opensource.adobe.com/cla.html. All Submissions you make to Adobe Inc. and its affiliates, assigns and subsidiaries (collectively “Adobe”) are subject to the terms of the Adobe Contributor License Agreement.
http://www.magento.com
Open Software License 3.0
11.55k stars 9.32k forks source link

Do NOT update stock status on CSV Product import if quantity is 0 and "Allow Qty Below 0 and Notify Customer" is set #34957

Closed atIOCrON closed 2 weeks ago

atIOCrON commented 2 years ago

Preconditions (*)

  1. Magento v2.4.3-p1

Steps to reproduce (*)

  1. Stores > Configuration > Catalog: Inventory > Backorders: Allow Qty Below 0 and Notify Customer

  2. Choose a product that is in stock with a qty greater than 0.

  3. System > Import > Entity Type: Products > Import Behavior: Add/Update > Import a file to set the qty to 0, e.g:

"sku","qty"
"test-sku","0"

Expected result (*)

a) The qty is changed to 0 b) The stock status remains "In Stock"

The stock status should NOT be changed because when backorders are set to "Allow Qty Below 0 and Notify Customer" Magento does NOT change the stock status when the qty reaches 0.

Actual result (*)

a) The qty is changed to 0 b) The stock status is changed to "Out of stock"

This behaviour appears to come from a previous issue that was fixed:

https://github.com/magento/magento2/issues/23042 https://github.com/magento/magento2/pull/24053

However, when backorders are set to "Allow Qty Below 0 and Notify Customer" Magento does NOT change the stock status when the qty reaches 0, therefore it shouldn't change it when the qty 0 is imported with this setting enabled.

m2-assistant[bot] commented 2 years ago

Hi @atIOCrON. Thank you for your report. To speed up processing of this issue, make sure that you provided the following information:

Make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, Add a comment to the issue:

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

For more details, review the Magento Contributor Assistant documentation.

Add a comment to assign the issue: @magento I am working on this

To learn more about issue processing workflow, refer to the Code Contributions.


:clock10: You can find the schedule on the Magento Community Calendar page.

:telephone_receiver: The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, join the Community Contributions Triage session to discuss the appropriate ticket.

:movie_camera: You can find the recording of the previous Community Contributions Triage on the Magento Youtube Channel

:pencil2: Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel

m2-assistant[bot] commented 2 years ago

Hi @engcom-Echo. 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:


engcom-Echo commented 2 years ago

Hi @atIOCrON,

Thank you for reporting the issue.

We have tried this issue on Magento 2.4-dev/2.4.3-P1 and we have successfully reproduced it.

Steps followed to reproduce issue:

  1. Installed the clean Magento 2.4-dev/2.4.3-P1.
  2. Updated Backorders to “Allow Qty Below 0 and Notify Customer”.
  3. Import new product by setting the quantity to “0”. (CSV file is attached) catalog_product_1.csv
  4. Observed the stock status for the uploaded imported product in the admin and for the customer.
  5. Product status is set to out of stock and the product is not salable to the frontend (See the attached screenshots)
1 Screenshot 2022-01-12 at 8 36 34 PM 2 Screenshot 2022-01-12 at 8 36 43 PM

The Backorders configuration is not working as stated in the documentation(https://docs.magento.com/user-guide/catalog/inventory-backorders.html), hence confirming the issue.

Thanks

github-jira-sync-bot commented 2 years ago

:white_check_mark: Jira issue https://jira.corp.magento.com/browse/AC-2107 is successfully created for this GitHub issue.

m2-assistant[bot] commented 2 years ago

:white_check_mark: Confirmed by @engcom-Echo. Thank you for verifying the issue.
Issue Available: @engcom-Echo, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.

DiVoronovich commented 2 years ago

@magento give me 2.4-develop instance

magento-deployment-service[bot] commented 2 years ago

Hi @DiVoronovich. Thank you for your request. I'm working on Magento instance for you.

magento-deployment-service[bot] commented 2 years ago

Hi @DiVoronovich, unfortunately there is no ability to deploy Magento instance at the moment. Please try again later.

magento-deployment-service[bot] commented 2 years ago

Hi @zhartaunik. Thank you for your request. I'm working on Magento instance for you.

magento-deployment-service[bot] commented 2 years ago

Hi @zhartaunik, unfortunately there is no ability to deploy Magento instance at the moment. Please try again later.

sdzhepa commented 2 years ago

@magento give me 2.4-develop instance

magento-deployment-service[bot] commented 2 years ago

Hi @sdzhepa. Thank you for your request. I'm working on Magento instance for you.

magento-deployment-service[bot] commented 2 years ago

Hi @sdzhepa, unfortunately there is no ability to deploy Magento instance at the moment. Please try again later.

zhartaunik commented 2 years ago

Unable to reproduce locally

pmaryglobalia commented 2 years ago

vendor/magento/module-catalog-import-export/Model/Import/Product.php This code added at Line 3191 is the culprit: if (isset($rowData['qty']) && $rowData['qty'] == 0) { $row['is_in_stock'] = 0; } It does not take in account the back order setting of the product

Zaahed commented 2 years ago

@magento I am working on this

Zaahed commented 2 years ago

@magento give me 2.4-develop instance

magento-deployment-service[bot] commented 2 years ago

Hi @Zaahed, unfortunately there is no ability to deploy Magento instance at the moment. Please try again later.

Zaahed commented 2 years ago

Can't reproduce this in 2.4-develop either. Backorders is set to Allow Qty Below 0 and Notify Customer. Set an existing product's qty to zero by importing a CSV file, stock status remains In Stock as expected.

engcom-Delta commented 3 weeks ago

Hi @atIOCrON ,

Thanks for your reporting and collaboration. We have re-verified the issue in 2.4-develop instance , but we are unable to reproduce the issue. Kindly refer the screenshots.

Steps to reproduce

  1. Stores > Configuration > Catalog: Inventory > Backorders: Allow Qty Below 0 and Notify Customer
  2. Choose a product that is in stock with a qty greater than 0.
  3. System > Import > Entity Type: Products > Import Behavior: Add/Update > Import a file to set the qty to 0 catalog_product_1.csv Observe Qty is 0 and stock is "Instock" image

Can you please re-verify and confirm if you are still facing the issue. Thanks.

engcom-Delta commented 2 weeks ago

Hi @atIOCrON ,

This issue is being closed since it has not been updated in a long time. Please feel free to reopen or raise a new ticket if the issue still exists.

Thanks.