magento / magento/inventory

Load product salability data on-demand

Open
#3,201 1 comment 0 reactions 2 assignees View on GitHub

@novikor is already working on this.

Since Nov 15, 2020.

  • #3202 by @novikor — closed without merging
1.2-develop Award: category of expertise Award: complex Award: special achievement Performance Progress: PR created
Dominant language
PHP
Stars
357
Forks
262
PR merge metrics
No merged PRs in 30d

Description

**Can and must be delivered together with #3243: Product Salability Improvements branch**

### Summary (*)
Product salability data should not be loaded every time on product load, on-demand only.
See `\Magento\CatalogInventory\Observer\AddInventoryDataObserver.`

### Examples (*)
- Current behavior can lead to performance degradation;
- It is required change to resolve #3200: Composite products support for IsProductSaleable

### Proposed solution
- Disable `\Magento\CatalogInventory\Observer\AddInventoryDataObserver`
- Remove[ `\Magento\InventoryBundleProduct\Plugin\CatalogInventory\Helper\Stock\AdaptAssignStatusToProductPlugin` ](https://github.com/magento/inventory/blob/1.2-develop/InventoryBundleProduct/Plugin/CatalogInventory/Helper/Stock/AdaptAssignStatusToProductPlugin.php)
- Remove [`\Magento\InventoryConfigurableProduct\Plugin\CatalogInventory\Helper\Stock\AdaptAssignStatusToProductPlugin`](https://github.com/magento/inventory/blob/1.2-develop/InventoryConfigurableProduct/Plugin/CatalogInventory/Helper/Stock/AdaptAssignStatusToProductPlugin.php)
- Remove [`\Magento\InventoryCatalog\Plugin\CatalogInventory\Helper\Stock\AdaptAssignStatusToProductPlugin`](https://github.com/magento/inventory/blob/1.2-develop/InventoryCatalog/Plugin/CatalogInventory/Helper/Stock/AdaptAssignStatusToProductPlugin.php)
- Call `AreProductsSalable` service in a plugin on `$product->isAvailable()` method in order to preserve current logic. See #3039 Async Salable Status, it is partially implemented there, so some commits should be cherry-picked.

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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.