A location‐allocation problem faced by a company that aims to locate warehouses to supply products to a set of customers is addressed in this paper. The company's objective is to minimize the total cost of locating the warehouses and the cost due to inventory policies. However, these inventory decisions are made by a different decision‐maker. In other words, once the company makes the location decisions, the decision‐maker associated with each warehouse must determine its own order quantity. Warehouses are allowed to have a certain maximum number of backorders, which represents an extra cost for them. This situation can be modeled as a bilevel programming problem, where the upper level is associated with the company that needs to minimize the costs related to location‐allocation and the total orders of each warehouse. Each warehouse is associated with an independent lower level, in which a warehouse manager aims to minimize the total inventory cost. The bilevel problem results in a single‐objective upper‐level problem with non‐linear, multiple independent lower‐level problems, making it generally challenging to find an optimal solution. A population‐based metaheuristic under the Brain Storm Optimization algorithm scheme is proposed. To solve each non‐linear problem associated with the lower level, the Lagrangian method is applied. Both decision levels are solved in a nested manner, leading to obtaining bilevel feasible solutions. To validate the effectiveness of the proposed algorithm, an enumerative algorithm is implemented. A set of benchmark instances has been considered to conduct computational experiments. Results show that optimality is achieved by the proposed algorithm for small‐sized instances. In the case of larger‐sized instances, the proposed algorithm demonstrates the same efficiency and consistent results. Finally, interesting managerial insights deduced from the computational experimentation and some proposals for future research directions are included.