namespace <Vendor><Module>ModelConfigurableProductResourceModelProduct; use MagentoFrameworkDBSelect; class StockStatusBaseSelectProcessor extends MagentoConfigurableProductModelResourceModelProductStockStatusBaseSelectProcessor
{
public function process(Select $select)
{
return $select;
}
}

A Great Solution For Magento 2 Out Of Stock Products

First, create a new module named Vendor/Module/etc/frontend/di.xml and add the following code.
Let’s get started!
And it enables you to manage customer subscriptions effectively.
<preference for="MagentoConfigurableProductPricingRenderFinalPriceBox" type="<Vendor><Module>PricingRenderFinalPriceBox" />

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<preference for="MagentoCatalogPricingRenderFinalPriceBox" type="VendorModulePricingRenderFinalPriceBox" />
</config>

Better yet, Magento 2 Out of Stock Notification by BSS doesn’t just bring the basic Out of Stock Notification feature. It also provides many other amazing features.

Method 1: For simple products

Usually, the first method also works for configurable products. But if it doesn’t, then you can use this method.
Lastly, this is a great way to build relationships with your customers.
namespace VendorModulePricingRender; use MagentoMsrpPricingPriceMsrpPrice;
use MagentoFrameworkPricingRenderPriceBox as BasePriceBox; class FinalPriceBox extends MagentoCatalogPricingRenderFinalPriceBox
{
protected function _toHtml()
{
$result = parent::_toHtml(); if(!$result) {
$result = BasePriceBox::_toHtml();
try {
/** @var MsrpPrice $msrpPriceType */
$msrpPriceType = $this->getSaleableItem()->getPriceInfo()->getPrice('msrp_price');
} catch (InvalidArgumentException $e) {
$this->_logger->critical($e);
return $this->wrapResult($result);
} //Renders MSRP in case it is enabled
$product = $this->getSaleableItem();
if ($msrpPriceType->canApplyMsrp($product) && $msrpPriceType->isMinimalPriceLessMsrp($product)) {
/** @var BasePriceBox $msrpBlock */
$msrpBlock = $this->rendererPool->createPriceRender(
MsrpPrice::PRICE_CODE,
$this->getSaleableItem(),
[
'real_price_html' => $result,
'zone' => $this->getZone(),
]
);
$result = $msrpBlock->toHtml();
} return $this->wrapResult($result);
} return $result;
}
}

The answer is:
Magento 2 Out of Stock Notification by BSS
You also can display the notify button on the product page, search result page and category page. 
With the default Magento, when a product is out of stock, its price is not displayed on the product page and category page.
CONTACT NOW to let us know your problems. We are willing to support you every time.
namespace <Vendor><Module>PricingRender; use MagentoFrameworkPricingRenderPriceBox as BasePriceBox; class FinalPriceBox extends MagentoConfigurableProductPricingRenderFinalPriceBox
{
protected function _toHtml()
{
$result = BasePriceBox::_toHtml();
//Renders MSRP in case it is enabled
if ($this->isMsrpPriceApplicable()) {
/** @var BasePriceBox $msrpBlock */
$msrpBlock = $this->rendererPool->createPriceRender(
MsrpPrice::PRICE_CODE,
$this->getSaleableItem(),
[
'real_price_html' => $result,
'zone' => $this->getZone(),
]
);
$result = $msrpBlock->toHtml();
} return $this->wrapResult($result);
}
}

It supports all customer groups, so you can even let your guests or not-logged-in customers subscribe to an out of stock product.
Table of Contents
We cannot not mention a unique feature of this extension – the Product Subscription Tab. The Product Subscription Tab is only available to your logged-in customers. This tab allows the customer to check information on products they have subscribed to and stop notification of any product or all products.

magento-2-out-of-stock-notification
In this article, we will show you a Magento 2 tutorial on how to show the price for out of stock products.

Next, it helps you analyze hot-selling products based on customers’ demands. Thanks to this, you can increase your revenue.
<type name="MagentoConfigurableProductModelResourceModelProductLinkedProductSelectBuilder">
<arguments>
<argument name="baseSelectProcessor" xsi:type="object"><Vendor><Module>ModelConfigurableProductResourceModelProductStockStatusBaseSelectProcessor</argument>
</arguments>
</type>

There are many benefits of the Out of Stock Notification feature.
However, some store owners want to display the price so customers can be aware of the products.
And today, we will show you step by step how to display out of stock product price on the product page and category page.
For any out of stock product, in your di.xml, add the following code:
This module allows customers to subscribe to the product they want and notify them immediately when the product is back in stock.
Check out its full list of features:
In this article, we have shown you the 2 best methods for Magento 2 show the price for out of stock products.
So what’s the better solution?
We have 2 methods for you for Magento 2 Show Price For Out Of Stock Products.
magento-2-out-of-stock-notification

  • Enable stock update notification for guest and not-logged-in customers
  • Automatically send email notify when product is back in stock
  • Allow the admin to manage stock subscription on the Customer Account Page
  • Support product stock alert on many pages (Product Page/Category Page/Search Result Page)
  • Allow stock alert for children product of the configurable products, grouped products and bundle products

Conclusion

We hope this blog is helpful and good luck to you!
First, it enhances the customer experience in your store. You can turn a negative experience into a positive one.
This extension also allows you to customize your notify button. You can change the text, button text color, or button color of the design easily.
BSS Commerce is one of the leading Magento extension providers and web development services in the world. With experienced and certified Magento developers, we commit to bringing high-quality products and services to optimize your business effectively. Furthermore, we offer FREE Installation – FREE 1-year Support and FREE Lifetime Update for every Magento extension.


Writing is a part of my life and I’m living for it.

Similar Posts