My 6 year old daughter has always had an issue with constipation. But, when she got to be about 3, I talked to the doctor about it and was told that I could give her UP TO (I started WAY less) 2 tablespoons of Milk of Magnesia (MOM) a day. I started out with half a teaspoon and worked my way up until I found a dose that worked. But, then she decided that in order to go, she had to have medicine. The cool thing about MOM is you can mix it into her milk and say nothing.
So, when my daughter would say her tummy hurt or her bum hurt, I'd give her a glass of "milk" and just wait.
Some kids (I don't exactly know why) have trouble with the going poo in the potty. My daughter did, my niece is going thru this now. that may or may not be the problem. Just understand that if going on the potty is part of the issue, you may have to deal with some messy drawers!! So, be prepared - and good luck!!