A supply chain is a network that creates and delivers products and services to customers. In this research, the four-level supply chain in the field of food products, including the levels of supplier, customer, and central and secondary warehouses, has been investigated. A mixed integer mathematical model of the research problem is presented to minimize chain costs, including the setting up and preparation of warehouses, transportation between transfer levels, and holding products. The proposed model is developed based on constraints such as inventory, warehouse capacity, vehicle capacity, and multi-period multi-product. The decision variables are determined after solving the model, which include the optimal number of central and secondary warehouses, the optimal amount of product transferred between the factory and central warehouse, the central warehouse and secondary warehouse, and the secondary warehouse and customer, the optimal amount of product storage in secondary warehouses, the type of vehicle for transportation between levels, and the capacity level of each product in each central warehouse. To validate the proposed model, experiments were conducted using the Kaleh company’s real data in GAMS software. Finally, the sensitivity analysis of the model was carried out on two important parameters influencing decision-making: demand and the cost of increasing the capacity of the central warehouse. The output results confirmed the validity and efficiency of the proposed model.