The solution above do not display Mailalert when oosp is allowed
In my case I would like to hide mail alert when oosp is refuse, and show it when it's allowed.
I only added ! to line 465 in mailalerts.php module (before Product::isAvailableWhenOutOfStock )
public function hookActionProductOutOfStock($params)
{
if (!$this->customer_qty ||
!Configuration::get('PS_STOCK_MANAGEMENT') ||
!Product::isAvailableWhenOutOfStock($params['product']->out_of_stock))
return;