PurposeThis study analyzes the impact of the COVID-19 pandemic on the consumption of locally produced food. In particular, it examines an extended model of the theory of planned behavior, with the addition of the perceived risk of becoming infected with the disease, locavorism and internal locus of control.Design/methodology/approachThe study employs data collected from an online panel of consumers from the five largest cities in Spain (n = 1,000). It uses partial least squares structural equation modeling (PLS-SEM) to test and validate the proposed theoretical model.FindingsThe results indicate that the perceived risk of COVID-19 drives consumers to embrace locavorism more and, although locavorism is a strong predictor of attitude, internal locus of control also has a strong impact on attitude and switching intentions. Subjective norm and attitude are strong predictors of switching intentions and purchase intentions, and switching intentions also have a powerful impact on purchase intentions.Originality/valueThis study extends previous research on locally produced food consumption in that it has proposed and tested a new conceptual model with the inclusion of the perceived risk of COVID-19, locavorism, internal locus of control and switching intentions, which were found to have an influence on purchasing behavior.