Plant and soil biodiversity can have significant effects on herbivore resistance mediated by plant metabolites. Here, we disentangled the independent effects of plant diversity and soil legacy on constitutive and herbivore-induced plant metabolomes of three plant species in two complementary microcosm experiments. First, we grew plants in sterile soil with three different plant diversity levels. Second, single plant species were grown on soil with different plant diversity-induced soil legacies. We infested a subset of all plants with Spodoptera exigua larvae, a generalist leaf-chewing herbivore, and assessed foliar and root metabolomes. Neither plant diversity nor soil legacy had significant effects on overall foliar, root, or herbivore-induced metabolome composition. Herbivore-induced metabolomes, however, differed from those of control plants. We also detected 139 significantly regulated metabolites by comparing plants grown in monocultures with conspecifics growing in plant or soil legacy mixtures. Moreover, plant-plant and plant-soil interactions regulated 141 metabolites in herbivore-induced plants. Taken together, plant diversity and soil legacy independently alter the concentration and induction of plant metabolites, thus affecting the plant's defensive capability. This is a first step towards disentangling plant and soil biodiversity effects on herbivore resistance, thereby improving our understanding of the mechanisms that govern ecosystem functioning.