Algolia on Magento 2 w/MSI

When MSI is enabled, and we have both algoliasearch-magento-2 (1.13.2) and algoliasearch-inventory-magento-2 (1.0.1) we are seeing every product being sent up to Algolia with ‘in_stock’ = 1.

It looks like maybe the MSI Algolia module may hard-code that to 1 in Helper/InventoryProductHelper.php

We’d like to hide the ‘Add To Cart’ button on the results hit.phtml template, what’s the best way to determine if the product is in stock/out of stock using the MSI module? Is there another attribute we should be using?

Hi @brandonifi,

With the MSI module, the stock check is now handled by a plugin, as you noted : https://github.com/algolia/algoliasearch-inventory-magento-2/blob/master/Plugin/Helper/ProductHelperPlugin.php . We don’t rely anymore on the “in_stock” attribute which is related to the old “Stock Inventory” module of Magento. That means that, by default, the products won’t be indexed if they are out of stock if the “show out of stock products” native Magento config is not turned on .

if you want to update the “in_stock” attribute with MSI classes, you can use a backend event and use the classes used in the Plugin above .

1 Like