magento / magento/inventory

Default source check missing on source item decrement for Legacy stock status update

Open
#3,336 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Progress: ready for grooming
Dominant language
PHP
Stars
357
Forks
262
PR merge metrics
No merged PRs in 30d

Description

### Preconditions (*)

1. Magento Inventory Version: 1.2.1-p1, develop
2. Magento Version 2.4.3-p1

### Steps to reproduce (*)

1. Decrement a source item for a source that is not the Default source

### Expected result (*)

1. The legacy stock status should not be updated if the decremented source item is not for the default source

### Actual result (*)

1. Legacy stock status is updated regardless of the source code

There is missing source code check at the beginning of the for loop in the SynchronizeLegacyStockAfterDecrementStockPlugin plugin
https://github.com/magento/inventory/blob/develop/InventoryCatalog/Plugin/InventoryApi/SynchronizeLegacyStockAfterDecrementStockPlugin.php#L102

The check is already implemented in \Magento\InventoryCatalog\Model\ResourceModel\DecrementQtyForLegacyStock called a line 99
https://github.com/magento/inventory/blob/develop/InventoryCatalog/Plugin/InventoryApi/SynchronizeLegacyStockAfterDecrementStockPlugin.php#L99

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with InventoryCatalog/Plugin/InventoryApi/SynchronizeLegacyStockAfterDecrementStockPlugin.php at the referenced loop and compare its handling with Magento\InventoryCatalog\Model\ResourceModel\DecrementQtyForLegacyStock around line 99. Verify the source-code condition for a non-default source, then run the relevant inventory tests if available; done means legacy stock status is unchanged for non-default sources.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
backend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.