Discontinued Product Redirect for Magento 2

Discontinue/Reintroduce mass action

You have the possibility to stop products via the command line, to do it in mass for example. To do this, run the following command: 

php bin/magento blackbird:product:discontinue

 

Here are the possible parameters:

 

  • --sku : gives you the ability to enter a SKU list to discontinue

Example : 

php bin/magento blackbird:product:discontinue --sku=123456,78910

 

  • -i ou --input : gives you the ability to provide a SKU list in CSV format (1 column made of SKUs)

Example : 

php bin/magento blackbird:product:discontinue -i “path/to/my/csv”

 

php bin/magento blackbird:product:discontinue --input=“path/to/my/csv”

 

Warning: at least one of these two parameters (sku or input) must be filled in to avoid stopping all your products by mistake. Both can be combined if you want to complete a file without having to modify it.

Example : 

php bin/magento blackbird:product:discontinue --input=“path/to/my/csv” --sku=123456,78910

 

  • -s ou --store-id :Allows you to determine on which store(s) to stop the products. Default: 0

Example : 

php bin/magento blackbird:product:discontinue -s 3,6

 

php bin/magento blackbird:product:discontinue --store-id=3,6

 

  • -r or --redirection-type : allows you to set the redirection type: 301 or 302. Default: 302

Example : 

php bin/magento blackbird:product:discontinue -r 301

 

php bin/magento blackbird:product:discontinue --redirection-type=302

 

For help, run the command: 

php bin/magento help blackbird:product:discontinue

 

Next command allows you to put back on sale products that have been previously stopped. This command uses the same parameters as discontinued, except for the redirect parameter (-r | --redirection-type)

php bin/magento blackbird:product:reintroduce

 

In addition to these CLI commands, it is possible to perform mass actions from the product grid: