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

Configurable products not deducting stock properly #57

Open
BrentRobert opened this issue Oct 11, 2021 · 4 comments
Open

Configurable products not deducting stock properly #57

BrentRobert opened this issue Oct 11, 2021 · 4 comments

Comments

@BrentRobert
Copy link

The change underneath resulted in the creation of multiple itemRequests for configurableProducts.
5e46cef

When ordering a configurable product, a row is created for the simple and the configurable. However Magento uses the SKU of the simple for both on the order item. The mapping that was created above results in allowing configurable order items to be deducted on the SKU of the simple.

The reason this has been unnoticed is because the itemRequests are not grouped as in 'GetItemsToDeductFromOrder'. Magento loops over these requests and overwrites SKU based in the array. Always using the latest value. In this case the simple.

foreach ($inventoryRequest->getItems() as $item) {
    $normalizedSku = $this->normalizeSku($item->getSku());
    $itemsTdDeliver[$normalizedSku] = $item->getQty();
}

TLDR;

  • The fix for grouped products actually broke the configurable ones.
  • The itemRequests should be grouped by SKU
@convenient
Copy link
Contributor

Thanks for your issue @BrentRobert If you have a PR to go with it that would be very much appreciated 👍

@BrentRobert
Copy link
Author

@convenient might you be able to add a test for grouped & configurable products?

@tr33m4n
Copy link
Contributor

tr33m4n commented Feb 9, 2024

Hi @BrentRobert, is this issue now resolved? You had a PR into the module but it's since been closed. Thanks

@BrentRobert
Copy link
Author

@tr33m4n I honestly have no idea. I closed the PR as it had been open for 2 years.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants