This paper introduces the price-elastic knapsack problem (PEKP), an extension of the classic knapsack problem where instead of fixed item characteristics, the weight of each item and the profit from including an item in the knapsack are a function of a parameter, namely the price. PEKP is first formulated as a generic nonlinear optimization problem and three special cases are investigated. First, we show a polynomial-time solvable case. Next, we formulate the case where the item weights are affine-linear functions as a quadratic program. The computational results show that solving the quadratic program to optimality is computationally challenging, and thus, an approach that decomposes the problem into three mixed integer programs is proposed. Similarly, the case where the weights of the items are piecewise-linear functions is investigated and a quadratic formulation is proposed. A solution approach based on decomposing the problem into three mixed integer programs that are solved independently is also proposed. Using randomly generated instances of varying sizes, the computational results show that the proposed decomposition leads to significant computational advantages compared to solving the quadratic program in the cases of affine-linear and piecewise-linear functions.