cancel
Showing results for 
Search instead for 
Did you mean: 

Change scope of Display Out of Stock Products from global to Website

Change scope of Display Out of Stock Products from global to Website

I am looking for a way to change the scope of the General - > Inventory -> Display Out of Stock Products option so that it can be specified on a website by website basis rather than changing it for all websites at the same time.

 

Any ideas?

2 REPLIES 2

Re: Change scope of Display Out of Stock Products from global to Website

I'm looking for the same solution.

Have you found something?


Maybe it works if you just add the config value in the core_config_data table for the shop.

Re: Change scope of Display Out of Stock Products from global to Website

I tried it and (at least) for the catalog view it worked.

You just need a custom module and put this in the app/code/[Namespace]/[ModuleName]/etc/adminhtml/system.xml file. This will change the Scope to Website and you can edit the Field in the Backend.

<config>
<system>

<!-- Make ShowOutOfStock a Website Value, and not global -->
        <section id="cataloginventory" translate="label" type="text" sortOrder="50" showInDefault="1" showInWebsite="1" showInStore="1">
            <group id="options" translate="label" type="text" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1">
                <field id="show_out_of_stock" translate="label comment" type="select" sortOrder="3" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1">
                    <label>Display Out of Stock Products</label>
                    <comment>Products will still be shown by direct product URLs.</comment>
                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                    <backend_model>Magento\CatalogInventory\Model\Config\Backend\ShowOutOfStock</backend_model>
                </field>
            </group>
        </section>
    </system>
</config>