Peace be upon you. According to Grand Ayatollah Khamenei (may Allah protect him), if fasting does not harm the nursing mother or her infant, she must fast. However, if refraining from breastfeeding and substituting with formula would harm the infant, the mother should break her fast and provide a compensation of three-quarters of a kilogram of food to a needy person for each day missed, and she must make up the fast afterward. If using formula does not harm the infant, then the mother is required to fast.
According to Grand Ayatollah Sistani (may Allah protect him), if a nursing mother fears harm to herself or her infant due to insufficient milk, she is allowed to break her fast and must make it up later, along with providing compensation. The compensation can be fulfilled by giving 750 grams of wheat or its flour, or any food, including bread or pasta. It is advisable that she only breaks her fast if breastfeeding is the only option available, and there is no alternative way to feed the child, even partially with formula. If partial breastfeeding would harm the child, especially in the early days, and if using formula would prevent the child from breastfeeding later, she is also permitted to break her fast and must make up the fast and provide compensation as mentioned.
May you be successful in all good deeds.