Inventory management in most practical settings faces challenges due to various restrictions on storage and replenishment of products. These restrictions may be posed by budget availability, different production/supply schedules for different products, and limited storage space shared by a number of products—very common in retail, food, and the pharmaceutical industry. Motivated by this, we investigate in this study how simultaneous restrictions on shared storage capacity and product‐specific order capacities impact optimal replenishments in a multi‐product system. We formulate the inventory replenishment problem as a multi‐period stochastic dynamic program, where products face stochastic demand with general distributions and excess demand is lost or fulfilled by emergency orders. We first fully characterize the optimal replenishment policy for two‐product systems, and provide a methodology to compute optimal replenishment quantities, which can be described as a dynamic priority‐based replenishment rule. Our results show that for each product, the optimal replenishment priority as well as quantity depends on the inventory levels of both products and all available capacities. More interestingly, the results show that capacity restrictions can flip the stocking priorities of products. Based on the optimal policy for two‐product systems, we develop a heuristic for multi‐product systems whose complexity scales linearly with the number of products. Under moderate storage capacities, our heuristic significantly outperforms the naive heuristics that ignore dynamic priority assignment, and closely captures the benefits of the optimal policy for systems with large number of products.