Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inventory Indexer | Configurable product is Out of Stock but should be In Stock #36421

Closed
1 of 5 tasks
VladyslavSikailo opened this issue Nov 4, 2022 · 18 comments
Closed
1 of 5 tasks
Labels
Adobe Commerce The issue related to the Adobe Commerce(EE) or B2B functionality Area: Product Component: Api Use with concrete module component label E.g. "Component: Api" + "Catalog" Component: ConfigurableProduct Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Priority: P1 Once P0 defects have been fixed, a defect having this priority is the next candidate for fixing. Progress: done Reported on 2.4.4 Indicates original Magento version for the Issue report. Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch

Comments

@VladyslavSikailo
Copy link
Contributor

VladyslavSikailo commented Nov 4, 2022

Preconditions and environment

magento/product-enterprise-edition:2.4.4

Steps to reproduce

  1. Create 2 websites, for example, website1 and website2
  2. Create stores and storeviews for created websites
  3. Create Inventory Source like source1
  4. Create Inventory Stock like stock1, and assign created source to created stock and to website2
  5. Create configurable product with one simple
    • Configurable: In Stock, price > 0, enabled
    • Simple: in stock, price > 0, enabled
    • Assign simple to both default and source1, set 11111 qty, in_stock = true
  6. Go to Configurable PDP and see that it's in stock
  7. Make Configurable Out of Stock
  8. See it's Out of Stock on PDP
  9. Update Configurable Stock Status using REST API
    • create integration token
    • run the following request
https://{magento_url}/rest/{second_storeview_code}/V1/products/{configurable_sku}/stockItems/{configurable_stock_item_id}

{
"stock_item": {
"item_id": 5,
"product_id": 5,
"qty": 11111,
"stock_id": 1,
"is_in_stock": true
}
}

Reindex and clear cache
Verify Front end  - Product details page
No issue for 2nd store.
Run the api request for main website store as well
Reindex and clear cache

You can find configurable_stock_item_id in cataloginventory_stock_item table, search by product_id
10. Go to admin and see that Configurable is In Stock now
11. Go to PDP and see that Configurable still Out of Stock on main website

Expected result

Configurable product should become In Stock on Frontend for both the websites

Actual result

Configurable product still Out of Stock on Frontend for main website. There is no issue for 2nd store

Additional information

It works when we update Configurable Stock using Admin.

It happens because it triggers Source item saving for Children products, and the Inventory module has a plugin to reindex data in inventory_stock_N table
see \Magento\InventoryIndexer\Plugin\InventoryApi\ReindexAfterSourceItemsSavePlugin::afterExecute

But when we run this request from API - the plugin is not triggered.

Release note

No response

Triage and priority

  • Severity: S0 - Affects critical data or functionality and leaves users without workaround.
  • Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
  • Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
  • Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
  • Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.
@m2-assistant
Copy link

m2-assistant bot commented Nov 4, 2022

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

  • Summary of the issue
  • Information on your environment
  • Steps to reproduce
  • Expected and actual results

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.


⚠️ According to the Magento Contribution requirements, all issues must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting.

🕙 You can find the schedule on the Magento Community Calendar page.

📞 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.

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

@m2-assistant
Copy link

m2-assistant bot commented Nov 4, 2022

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

  • 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).

    DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.

  • 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.

  • 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • 4. Verify that the issue is reproducible on 2.4-develop branch

    Details- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!

  • 5. Add label Issue: Confirmed once verification is complete.

  • 6. Make sure that automatic system confirms that report has been added to the backlog.

@alikhani97
Copy link

@magento give me 2.4-develop instance

@magento-deployment-service
Copy link

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

@magento-deployment-service
Copy link

@engcom-November
Copy link
Contributor

@magento give me 2.4-develop instance

@magento-deployment-service
Copy link

Hi @engcom-November. Thank you for your request. I'm working on Magento instance for you.

@magento-deployment-service
Copy link

@paulhaidon
Copy link

We have had similar in that we are experiencing issues since upgrading from 2.4.4 to 2.4.5-p1 but we don't have to update it via API for it to fail - we are just updating it via the backend.

When a configurable product's "simple product" variation goes out of stock, it is being set to out of stock on the frontend but when we add stock to the simple product again, the frontend still doesn't think it is in stock.

Side note regarding odd behaviour:
If the attributes are set to dropdown menus, they grey out the out of stock product as expected. But if you are using image or text swatches, they do not grey out at all which means users can select them and then "add to cart" which then triggers - "This product is out of stock" which isn't overly great from a UX perspective.

I was in the middle of creating my own issue for this when I noticed others are having issues with stock related updates.

@engcom-November
Copy link
Contributor

engcom-November commented Nov 16, 2022

Hi @VladyslavSikailo ,
Thank you for reporting and collaboration. Verified the issue on Magento 2.4 enterprise edition with inventory enabled and the issue is not reproducible on 2nd store but is reproducible on 1st store with below steps performed.

  1. Configurable product assigned to both the stores and both stocks
  2. Rest API PUT request to update stock with below payload. Note: stock id is mandatory to be given in the payload to update the stock
    {
    "stock_item": {
    "item_id": 5,
    "product_id": 5,
    "qty": 11111,
    "stock_id": 1,
    "is_in_stock": true
    }
    }
  3. Reindex and clear cache
    Product displayed as expected in 2nd store with in stock
    image

On updating the stock for main website (default store) - Product is still out of stock and not displayed on front end default store. Hence confirming this issue.
image

@engcom-November engcom-November added Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Component: ConfigurableProduct Component: Api Use with concrete module component label E.g. "Component: Api" + "Catalog" Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch Area: Product Reported on 2.4.4 Indicates original Magento version for the Issue report. Adobe Commerce The issue related to the Adobe Commerce(EE) or B2B functionality labels Nov 16, 2022
@m2-community-project m2-community-project bot moved this from Ready for Confirmation to Confirmed in Issue Confirmation and Triage Board Nov 16, 2022
@github-jira-sync-bot
Copy link

✅ Jira issue https://jira.corp.adobe.com/browse/AC-7023 is successfully created for this GitHub issue.

@m2-assistant
Copy link

m2-assistant bot commented Nov 16, 2022

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

@engcom-Hotel engcom-Hotel added the Priority: P1 Once P0 defects have been fixed, a defect having this priority is the next candidate for fixing. label Nov 22, 2022
@m2-community-project m2-community-project bot added this to Ready for Development in High Priority Backlog Nov 22, 2022
@davirs
Copy link

davirs commented Jan 13, 2023

I have the same problem here with magento version 2.4.4 with php 8.1.
The products work correctly and randomly some entire product category or specific products are simply marked in the display as "out of stock". Both configurable products and simple products are correct and in stock, it is only in the frontend display that has this bug.

Here I also have the problem that was commented above, when the product is sold and has zero saleable quantity it keeps appearing in the frontend as if it was in stock...

Really are 2 extremely serious bugs because they disturb sales and generate numerous complaints daily.

If anyone has an alternative solution I would be very grateful!

@m2-community-project m2-community-project bot moved this from Ready for Development to Dev In Progress in High Priority Backlog Apr 4, 2023
@github-jira-sync-bot github-jira-sync-bot added Progress: PR Created Indicates that Pull Request has been created to fix issue and removed Progress: dev in progress labels Apr 11, 2023
@m2-community-project m2-community-project bot removed the Progress: PR Created Indicates that Pull Request has been created to fix issue label Apr 24, 2023
@github-jira-sync-bot github-jira-sync-bot added Progress: PR Created Indicates that Pull Request has been created to fix issue and removed Progress: dev in progress labels May 18, 2023
@realadityayadav
Copy link
Member

@engcom-November Can you please send us a PR or commit link for this?

@m2-community-project m2-community-project bot moved this from Dev In Progress to Done in High Priority Backlog Sep 3, 2023
@m2-community-project m2-community-project bot removed the Progress: PR Created Indicates that Pull Request has been created to fix issue label Sep 3, 2023
@engcom-Bravo
Copy link
Contributor

Hello,

As I can see this issue got fixed in the scope of the internal Jira ticket AC-7023 by the internal team
Related commits: https://github.com/magento-commerce/inventory/commit/2ca3fcbfaaa34212a6053c436e6baa6ccae241e5

Based on the Jira ticket, the target version is 2.4.7-beta2.

Thanks

@VladyslavSikailo
Copy link
Contributor Author

Hey @engcom-Bravo ,

As the community has no access to magento-commerce repo, could you please share the patch with the fix?

@engcom-Bravo
Copy link
Contributor

Hi @VladyslavSikailo,

Could you please check these commits :

https://github.com/search?q=repo%3Amagento%2Finventory+AC-7023&type=commits

Thanks.

@VladyslavSikailo
Copy link
Contributor Author

Hey @engcom-Bravo

We have created the patch using the mentioned commits and applied it to our project. Unfortunatelly it does not work for us.
Do you have any ideas why? Are there some other commits that may be part of the fix?
Also, could you please tell in which Magento release these fixes supposed to be included?

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Adobe Commerce The issue related to the Adobe Commerce(EE) or B2B functionality Area: Product Component: Api Use with concrete module component label E.g. "Component: Api" + "Catalog" Component: ConfigurableProduct Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Priority: P1 Once P0 defects have been fixed, a defect having this priority is the next candidate for fixing. Progress: done Reported on 2.4.4 Indicates original Magento version for the Issue report. Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch
Projects
Development

No branches or pull requests

9 participants