Skip to content

[Issue] Legacy stock status not updated after source items save #40212

@darektw

Description

@darektw

Preconditions and environment

Magento version : 2.4.8-p2 CE
PHP 8.3
mysql: 8.0.42
elasticsearch: 8.11

Issue discovered running integration tests, after upgrade from Magento 2.4.7

Steps to reproduce

  1. Create simple product with stock data ['use_config_manage_stock' => 1, 'qty' => 0, 'is_qty_decimal' => 0, 'is_in_stock' => 0]
  2. Update stock item
        /** \Magento\InventoryApi\Api\Data\SourceItemInterfaceFactory */
        $sourceItem = $this->sourceItemInterfaceFactory->create(['data' => [
            'sku' => '[sku]',
            'source_code' => 'default',
            'quantity' => 10,
            'status' => 1
        ]]);

        /** \Magento\Inventory\Model\SourceItem\Command\SourceItemsSave */
        $this->sourceItemsSave->execute([$sourceItem]);
  1. check $product->isSalable()

Expected result

Product should be salable after source item update.

Actual result

Legacy stock status is not updated, which causes the problem with product availability.

Additional information

In Magento 2.4.8 the \Magento\InventoryCatalog\Model\SourceItemsSaveSynchronization\SetDataToLegacyCatalogInventory has been rewritten.

https://github.com/magento/inventory/blob/9659ed95f844e1a3fa55d81d179ed3631f91168d/InventoryCatalog/Model/SourceItemsSaveSynchronization/SetDataToLegacyCatalogInventory.php

magento/inventory@9659ed9#diff-bae52abf5559f41d7f3464d6171bb3ccf703b610d977014b4626098eb3643a05

In the class \Magento\InventoryCatalog\Model\UpdateDefaultStock:78 $statusAfter is false which prevents legacy stock update.

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

Metadata

Metadata

Assignees

Labels

Issue: needs updateAdditional information is require, waiting for responseReported on 2.4.8-p2Indicates original Magento version for the Issue report.Triage: Dev.ExperienceIssue related to Developer Experience and needs help with Triage to Confirm or Reject it

Type

No type

Projects

Status

Needs Update

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions