Want to redirect for the products who are out of stock to custom url

Had tried below url but it did not helped https://stackoverflow.com/questions/4824072/magento-out-of-stock-product-seo-problem

  • 301 is permanent redirect. What would seo benefit of doing this instead of using status or visibility to show a 404? I can understand 302 in case comes back in stock? Or are these discontinued products? – Dominic Xigen Jun 12 '19 at 0:22
  • No they are not discontinued just stock has got over. But in future, there can be such a case where the product can be discontinued – insoftservice Jun 12 '19 at 1:15
  • In that case do you still want to use 301's? – Dominic Xigen Jun 12 '19 at 7:17
  • But how to do it. That's my question how to redirect to custom url with 301/302 when there is no stock – insoftservice Jun 12 '19 at 20:08

You need to overide this method



Check stock with something like this


Then redirect using something like this


| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.