Posted on

Discontinued product and SEO in WooCommerce

This little snippet will help you to handle proper redirection when dealing with discontinued products.
All you have to do is add it to your functions.php (in your theme folder) and set your product status to “draft” when you are sure you’ll never have it back in stock again.

By doing this you’ll avoid 404 errorsĀ and redirect your customer to your shop homepage. Note that you could replace the 301 code (permanent redirect) to a 302 code (temporary redirect) for temporary redirect (the product will be published again).

One thought on “Discontinued product and SEO in WooCommerce

  1. Hi,

    Nice fix… gonna try this…

    Could i also send to a custom page?

    And how would this work for a discontinued category (for shop that have collections set by year)


Comments are closed.