diff --git a/src/Plugin/QueueWorker/CommerceStockNotifyQueue.php b/src/Plugin/QueueWorker/CommerceStockNotifyQueue.php index 715aaf9bd47f56f3a9e3917dc0d2a282b322edef..4a73506bc8babb0548c8b435ca718d33e715e797 100644 --- a/src/Plugin/QueueWorker/CommerceStockNotifyQueue.php +++ b/src/Plugin/QueueWorker/CommerceStockNotifyQueue.php @@ -99,6 +99,10 @@ class CommerceStockNotifyQueue extends QueueWorkerBase implements ContainerFacto // The product or variation is inactive, ignore it. throw new \Exception("Variation $sku (or it\'s parent product) is unpublished. Skipping for now."); } + if (!commerce_stock_notifications_check_stock($variation)) { + // There is no stock right now, do nothing. + return; + } // Parameters that will be used during the mailing procedure. $params = [ 'mail_title' => $this->token->replace(AdminConfigForm::getValuesFromConfig()['email_subject'], [