Skip to content

Enables filtering by stock status

License

GPL-3.0, Unknown licenses found

Licenses found

GPL-3.0
LICENSE.txt
Unknown
COPYING.txt
Notifications You must be signed in to change notification settings

nordcomputer/magento2-stockfilter

Repository files navigation

Magento 2 Module Nordcomputer Stockfilter

``nordcomputer/module-stockfilter``

Main Functionalities

Enabels filtering by stock status

Installation

* = in production please use the --keep-generated option

Type 1: Zip file

  • Unzip the zip file in app/code/Nordcomputer and rename the directory to Stockfilter
  • Enable the module by running php bin/magento module:enable Nordcomputer_Stockfilter
  • Apply database updates by running php bin/magento setup:upgrade*
  • Flush the cache by running php bin/magento cache:flush

Type 2: Composer

  • Add the composer repository to the configuration by running composer config repositories.nordcomputer/module-stockfilter git "[email protected]:nordcomputer/magento2-stockfilter.git"
  • Install the module composer by running composer require nordcomputer/module-stockfilter
  • enable the module by running php bin/magento module:enable Nordcomputer_Stockfilter
  • apply database updates by running php bin/magento setup:upgrade*
  • Flush the cache by running php bin/magento cache:flush

Steps after installation (IMPORTANT)

  • Since this extension does not set the attribute for existing products (the value stays empty after installation), you need to set the attribute to Yes for every simple product (you can do so by mass-action).
  • Also every new created product needs to be set to Yes (Default value) for at least one time, otherwise, the attribute for that specific product does not get created.

Once the attribute was set to Yes at least one time, the cronjob does his thing and sets the value automatically with every run.

Configuration

You can find the configuration for this extension in Stores -> Configuration -> Catalog -> Inventory -> Stock Filter Cronjob Configuration

The Cronjob iterates over all simple products and sets the newly created attribute "filter-stock" according to the stock status of the product.

Uninstalling

As this extension creates an attribute, the attribute needs to be removed when the extension get uninstalled.

Method 1 (installed via composer)

You can uninstall this extension by running 'bin/magento module:uninstall Nordcomputer_Stockfilter --remove-data'

Method 2 (installed via Download)

  • delete the Stockfilter directory in /app/code/Nordcomputer

  • delete filter_stock from the eav_attribute table in your database

  • run following commands:

    bin/magento setup:di:compile
    bin/magento setup:static-content:deploy -f
    bin/magento indexer:reindex
    bin/magento c:f