Bismihi ta'ala
Although the two years of breastfeeding has been recommended in the holy Quran, it does not necessarily mean you cannot wean your child before that. When you are introducing solid and nutritive foods, you can gradually minimise the breastfeeding until your infant is completely weaned.
Wassalam