1. Although plants and herbivores interact under varying soil resources and natural enemy effects, little is known about how these factors influence plant-herbivore interactions and shape the evolution of plant and herbivore traits. Here we ask whether soil fertility and parasitoids shape selection on fruit number imposed by a seed predator (SP) on the perennial herb Ruellia nudiflora. 2. We used a common garden where half the plants of 14 genetic families were fertilized, and recorded the abundance of cleistogamous (CL) fruits and seeds, SPs, and parasitoids. We calculated relative fitness per family based on CL seed number under the following three scenarios: Three trophic levels (accounting for SP and parasitoid effects), two trophic levels (accounting for SP but not parasitoid effects), and one trophic level (fitness in absence of SPs), and compared selection strength on fruit number between trophic scenarios and fertility environments. 3. In unfertilized conditions, SPs selected for increased CL fruit number, whereas parasitoids dampened (but did not eliminate) this selective impact. With fertilization, however, selection by SPs was reduced and unaffected by parasitoids. 4. Synthesis: Overall, we show that parasitoids can shape herbivore selection on plants, but that both herbivore and parasitoid selective impacts depend upon the abiotic environment. These findings underscore how linkages between abiotic factors and trophic complexity influence the ecological and evolutionary outcomes of species interactions