// Product details page > back in stock subscribe public virtual async Task <IActionResult> SubscribePopup(int productId) { var product = await _productService.GetProductByIdAsync(productId); if (product == null || product.Deleted) { throw new ArgumentException("No product found with the specified id"); } var model = new BackInStockSubscribeModel { ProductId = product.Id, ProductName = await _localizationService.GetLocalizedAsync(product, x => x.Name), ProductSeName = await _urlRecordService.GetSeNameAsync(product), IsCurrentCustomerRegistered = await _customerService.IsRegisteredAsync(await _workContext.GetCurrentCustomerAsync()), MaximumBackInStockSubscriptions = _catalogSettings.MaximumBackInStockSubscriptions, CurrentNumberOfBackInStockSubscriptions = (await _backInStockSubscriptionService .GetAllSubscriptionsByCustomerIdAsync((await _workContext.GetCurrentCustomerAsync()).Id, (await _storeContext.GetCurrentStoreAsync()).Id, 0, 1)) .TotalCount }; if (product.ManageInventoryMethod == ManageInventoryMethod.ManageStock && product.BackorderMode == BackorderMode.NoBackorders && product.AllowBackInStockSubscriptions && await _productService.GetTotalStockQuantityAsync(product) <= 0) { //out of stock model.SubscriptionAllowed = true; model.AlreadySubscribed = await _backInStockSubscriptionService .FindSubscriptionAsync((await _workContext.GetCurrentCustomerAsync()).Id, product.Id, (await _storeContext.GetCurrentStoreAsync()).Id) != null; } return(PartialView(model)); }