Stock and Out Of Stock filter in Layered NavigationFilter out Configurable Products in layered navigation who have out of stock filtered optionHide Out of Stock Products in Layered Navigation, but Not CategoryFilter Products with layered navigation using AND conditionMagento layered navigation filter out configurable product out of stockHide out of stock products in Layered NavigationHow to add layered Navigation filter as stock availability?Customize Layered Navigation and Catalog List BehaviourMagento 2 Layered Navigation on Advanced Search Result PageStock availability filter not workinghide out of stock products from layered navigation in magento2

Why is su world executable?

Adding things to bunches of things vs multiplication

Unsolved Problems due to Lack of Computational Power

What should I do with the stock I own if I anticipate there will be a recession?

Good way to stop electrolyte tabs from turning into powder?

Why do aircraft leave cruising altitude long before landing just to circle?

Why won't the Republicans use a superdelegate system like the DNC in their nomination process?

Do I need to start off my book by describing the character's "normal world"?

Why do we use low resistance cables to minimize power losses?

Is there a word for returning to unpreparedness?

Why do so many people play out of turn on the last lead?

What would cause a nuclear power plant to break down after 2000 years, but not sooner?

How can I enter recovery mode (for Mac OS, on an iMac) remotely?

How to mock ApexTestQueueItem, AsyncApexJob, and ApexTestResult for test coverage?

Why don't modern jet engines use forced exhaust mixing?

What should we do with manuals from the 80s?

Does Medium Armor's Max dex also put a cap on the negative side?

Attacking the Hydra

Meaning of だけはわからない

String routines

How do I ask for 2-3 days per week remote work in a job interview?

Typesetting "hollow slash"

Eric Andre had a dream

What was the intention with the Commodore 128?



Stock and Out Of Stock filter in Layered Navigation


Filter out Configurable Products in layered navigation who have out of stock filtered optionHide Out of Stock Products in Layered Navigation, but Not CategoryFilter Products with layered navigation using AND conditionMagento layered navigation filter out configurable product out of stockHide out of stock products in Layered NavigationHow to add layered Navigation filter as stock availability?Customize Layered Navigation and Catalog List BehaviourMagento 2 Layered Navigation on Advanced Search Result PageStock availability filter not workinghide out of stock products from layered navigation in magento2






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















I try to add Stock and Out Of Stock filter in the Layered Navigation.
I set the configuration of the attribute "quantity_and_stock_status":



enter image description here



In the storefront I look the filter, but if the configuration -> Display Product out of Stock is enabled it counts all items without stock status condition.



I have seen the following in the code. Magento does not filter if the option Display Product out of Stock is enabled.



 if (!$this->inventoryConfig->isShowOutOfStock($currentScopeId)) 
$select->where('stock_index.stock_status = ?', Stock::STOCK_IN_STOCK);



I have tried to replace this class but the methods are private and it gives error.



Is there any alternative?










share|improve this question






























    0















    I try to add Stock and Out Of Stock filter in the Layered Navigation.
    I set the configuration of the attribute "quantity_and_stock_status":



    enter image description here



    In the storefront I look the filter, but if the configuration -> Display Product out of Stock is enabled it counts all items without stock status condition.



    I have seen the following in the code. Magento does not filter if the option Display Product out of Stock is enabled.



     if (!$this->inventoryConfig->isShowOutOfStock($currentScopeId)) 
    $select->where('stock_index.stock_status = ?', Stock::STOCK_IN_STOCK);



    I have tried to replace this class but the methods are private and it gives error.



    Is there any alternative?










    share|improve this question


























      0












      0








      0








      I try to add Stock and Out Of Stock filter in the Layered Navigation.
      I set the configuration of the attribute "quantity_and_stock_status":



      enter image description here



      In the storefront I look the filter, but if the configuration -> Display Product out of Stock is enabled it counts all items without stock status condition.



      I have seen the following in the code. Magento does not filter if the option Display Product out of Stock is enabled.



       if (!$this->inventoryConfig->isShowOutOfStock($currentScopeId)) 
      $select->where('stock_index.stock_status = ?', Stock::STOCK_IN_STOCK);



      I have tried to replace this class but the methods are private and it gives error.



      Is there any alternative?










      share|improve this question














      I try to add Stock and Out Of Stock filter in the Layered Navigation.
      I set the configuration of the attribute "quantity_and_stock_status":



      enter image description here



      In the storefront I look the filter, but if the configuration -> Display Product out of Stock is enabled it counts all items without stock status condition.



      I have seen the following in the code. Magento does not filter if the option Display Product out of Stock is enabled.



       if (!$this->inventoryConfig->isShowOutOfStock($currentScopeId)) 
      $select->where('stock_index.stock_status = ?', Stock::STOCK_IN_STOCK);



      I have tried to replace this class but the methods are private and it gives error.



      Is there any alternative?







      magento2 magento2.2 layered-navigation






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 29 at 9:44









      chdzmachdzma

      4652 silver badges14 bronze badges




      4652 silver badges14 bronze badges























          1 Answer
          1






          active

          oldest

          votes


















          0














          It's not enough to change that single line of code
          $this->scopeConfig->isSetFlag('cataloginventory/options/show_out_of_stock');
          is called throughout the code in different ways and manners.
          The best approach would be to find every single call for this config and change it with plugins or preference if the methods are private, which they mostly are as it seems.
          Or you could do the worst hack in magento history and take the laziest approach, where you create a plugin for MagentoFrameworkAppConfig and check if the path is 'cataloginventory/options/show_out_of_stock' && your_custom_case and return true of false based on your needs.






          share|improve this answer



























            Your Answer








            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "479"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: false,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f267935%2fstock-and-out-of-stock-filter-in-layered-navigation%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            It's not enough to change that single line of code
            $this->scopeConfig->isSetFlag('cataloginventory/options/show_out_of_stock');
            is called throughout the code in different ways and manners.
            The best approach would be to find every single call for this config and change it with plugins or preference if the methods are private, which they mostly are as it seems.
            Or you could do the worst hack in magento history and take the laziest approach, where you create a plugin for MagentoFrameworkAppConfig and check if the path is 'cataloginventory/options/show_out_of_stock' && your_custom_case and return true of false based on your needs.






            share|improve this answer





























              0














              It's not enough to change that single line of code
              $this->scopeConfig->isSetFlag('cataloginventory/options/show_out_of_stock');
              is called throughout the code in different ways and manners.
              The best approach would be to find every single call for this config and change it with plugins or preference if the methods are private, which they mostly are as it seems.
              Or you could do the worst hack in magento history and take the laziest approach, where you create a plugin for MagentoFrameworkAppConfig and check if the path is 'cataloginventory/options/show_out_of_stock' && your_custom_case and return true of false based on your needs.






              share|improve this answer



























                0












                0








                0







                It's not enough to change that single line of code
                $this->scopeConfig->isSetFlag('cataloginventory/options/show_out_of_stock');
                is called throughout the code in different ways and manners.
                The best approach would be to find every single call for this config and change it with plugins or preference if the methods are private, which they mostly are as it seems.
                Or you could do the worst hack in magento history and take the laziest approach, where you create a plugin for MagentoFrameworkAppConfig and check if the path is 'cataloginventory/options/show_out_of_stock' && your_custom_case and return true of false based on your needs.






                share|improve this answer













                It's not enough to change that single line of code
                $this->scopeConfig->isSetFlag('cataloginventory/options/show_out_of_stock');
                is called throughout the code in different ways and manners.
                The best approach would be to find every single call for this config and change it with plugins or preference if the methods are private, which they mostly are as it seems.
                Or you could do the worst hack in magento history and take the laziest approach, where you create a plugin for MagentoFrameworkAppConfig and check if the path is 'cataloginventory/options/show_out_of_stock' && your_custom_case and return true of false based on your needs.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Aug 5 at 12:10









                MagarusuMagarusu

                2781 gold badge3 silver badges10 bronze badges




                2781 gold badge3 silver badges10 bronze badges






























                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Magento Stack Exchange!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f267935%2fstock-and-out-of-stock-filter-in-layered-navigation%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Get product attribute by attribute group code in magento 2get product attribute by product attribute group in magento 2Magento 2 Log Bundle Product Data in List Page?How to get all product attribute of a attribute group of Default attribute set?Magento 2.1 Create a filter in the product grid by new attributeMagento 2 : Get Product Attribute values By GroupMagento 2 How to get all existing values for one attributeMagento 2 get custom attribute of a single product inside a pluginMagento 2.3 How to get all the Multi Source Inventory (MSI) locations collection in custom module?Magento2: how to develop rest API to get new productsGet product attribute by attribute group code ( [attribute_group_code] ) in magento 2

                    Category:9 (number) SubcategoriesMedia in category "9 (number)"Navigation menuUpload mediaGND ID: 4485639-8Library of Congress authority ID: sh85091979ReasonatorScholiaStatistics

                    Magento 2.3: How do i solve this, Not registered handle, on custom form?How can i rewrite TierPrice Block in Magento2magento 2 captcha not rendering if I override layout xmlmain.CRITICAL: Plugin class doesn't existMagento 2 : Problem while adding custom button order view page?Magento 2.2.5: Overriding Admin Controller sales/orderMagento 2.2.5: Add, Update and Delete existing products Custom OptionsMagento 2.3 : File Upload issue in UI Component FormMagento2 Not registered handleHow to configured Form Builder Js in my custom magento 2.3.0 module?Magento 2.3. How to create image upload field in an admin form