First of all, it makes sense to treat historical zeros due to stockouts separately. (These do not represent unconstrained demands.) I would simply remove these historical periods from the training data so they do not bias your predictions for in-stock periods.
This means that methods that rely on the time series having no "holes", like ARIMA or Exponential Smoothing, will have a problem. So I would go with a simple regression with seasonal dummies, possibly a trend predictor, and predictors for all other drivers like promotions. Use OLS for fast selling products, and some kind of negative binomial regression for slower movers.
If this is a problem, you could also use Boolean predictors for historical stockouts and use a forecasting method that incorporates regressors, like ARIMAX or regression with ARIMA errors.
In forecasting, just forecast with your model. If you know there will be no product, overwrite the forecast with a zero.
This should do as a first pass. You can later elaborate. Perhaps if your product is out of stock, people shift demand to other products (so you might model substitution effects on other products), or they postpone buying the product (so you might model higher demand right after stockouts). If stockouts can be anticipated by the customer, they might even pull demand forward in time.