inventory icon indicating copy to clipboard operation
inventory copied to clipboard

Out of stock products are not rendered with prices

Open wexo-team opened this issue 4 years ago • 6 comments

Preconditions (*)

  1. Magento 2.3.5-p1 with magento/inventory-composer-metapackage version 1.1.5 (module-inventory, 1.0.8)

Steps to reproduce (*)

  1. Configurable products that are out of stock
  2. The setting "show out of stock products" = yes (config path "cataloginventory/options/show_out_of_stock")

Expected result (*)

That the products are visible and shown with price

Actual result (*)

  1. The products are visible but shown without price

It seems like there's a reversed logic bug in: https://github.com/magento/inventory/blob/1.1.5-p1/InventoryConfigurableProduct/Pricing/Price/LowestPriceOptionsProvider/StockStatusBaseSelectProcessor.php#L99 So the above is saying: If we SHOULD NOT show out of stock, do nothing. If we SHOULD show out of stock, ensure that the products returned are IN STOCK - as seen here: https://github.com/magento/inventory/blob/1.1.5-p1/InventoryConfigurableProduct/Pricing/Price/LowestPriceOptionsProvider/StockStatusBaseSelectProcessor.php#L133 . This is a complete reverse of intention. This is addressed in https://github.com/magento/inventory/pull/2670 but it seems like the fix introduces new issues.

To get the prices showing \Magento\Catalog\Pricing\Render\FinalPriceBox::_toHtml also needs to be adjusted as it has a check for salable through \Magento\ConfigurableProduct\Plugin\Catalog\Model\Product\Pricing\Renderer\SalableResolver::afterIsSalable without checking the "show out of stock" setting first.

wexo-team avatar Aug 04 '20 06:08 wexo-team

Hi @wexo-team. Thank you for your report. To help us process this issue please make sure that you provided sufficient information.

Please, add a comment to assign the issue: @magento I am working on this


m2-assistant[bot] avatar Aug 04 '20 06:08 m2-assistant[bot]

@magento I am working on this

TadeuRodrigues avatar Aug 13 '20 17:08 TadeuRodrigues

@TadeuRodrigues thanks for starting work on the issue. Any progress yet? Do you have any thoughts on what release it might be introduced in?

wexo-team avatar Sep 03 '20 06:09 wexo-team

@wexo-team not yet but i gonna have a release so soon (this week, I will text you)

TadeuRodrigues avatar Sep 18 '20 18:09 TadeuRodrigues

Hi guys, were you able to find any solution here? It seems eveyone reached eventually the same conclusion about this issue which led here. I'm finding myself in the same predicament and looking for a workaround

ioweb-gr avatar Mar 11 '21 05:03 ioweb-gr

Unless I am missing something significant, it looks to me like there's a remarkable typo in: \Magento\InventoryConfigurableProduct\Pricing\Price\LowestPriceOptionsProvider\StockStatusBaseSelectProcessor::process

The early exit currently is:

    if (!$this->stockConfig->isShowOutOfStock()) {
        return $select;
    }

However, since this method is adding stock filtering, the early should be:

    if ($this->stockConfig->isShowOutOfStock()) {
        return $select;
    }

Reference: https://github.com/magento/inventory/blob/1.2-develop/InventoryConfigurableProduct/Pricing/Price/LowestPriceOptionsProvider/StockStatusBaseSelectProcessor.php#L99

bassplayer7 avatar Jun 29 '21 19:06 bassplayer7