The transcription factor 7-like 2 (TCF7L2) genetic variants have shown differential effect on low-fat and high-fat diet in obese subjects. Nopal is a Mexican variety of cactus that is a traditional food and has been used in the treatment of diabetes. Its hypoglycaemic effect may be because of its soluble fibre (mucopolysaccharide) content. This study analysed the effects of the rs7903146 and rs12255372TCF7L2 variants on anthropometric, metabolic and hormonal parameters in type 2 diabetes mellitus patients who consumed fibre from either nopal tortilla or wholegrain bread for 8 weeks. We followed-up seventy-four patients who consumed an individualised isoenergetic diet that included nopal tortilla (Diet 1) and sixty-three patients with a diet that included wholegrain bread (Diet 2). Anthropometric, metabolic and hormonal measures were collected at baseline and final intervention. The size effect and carry-over effect were estimated. To assess the interaction of genotype and diets, we used a general linear model repeated-measures analysis. Minor allele frequency of rs7903146T was 0·27 and for rs12255372T it was 0·13. At 8 weeks after Diet 1 intake, weight, BMI, waist and hip circumference decreased (P=0·00015) in rs7903146CC and rs12255372GG genotypes. In particular, patients carrying of the rs7903146CC and consuming Diet 1 showed a reduction in waist circumference of more than 2·5 cm compared with Diet 2 (P<0·001). No significant interaction between rs7903146 or rs12255372 and diet was seen in this study. In conclusion, in the carriers of the rs7903146CC and rs12255372GG wild types, significant changes in all anthropometric measures were observed, and had better response to both diets.