We had a similar situation with our son not that long ago. Obviously, water, fiber, fruits and veg. But I think what really worked, and someone told this to me. Wrap a bunch of cheap presents from the dollar store, grocery store, wherever. Candy, soap, toys, crafts, anything you think he may like. Keep them in the bathroom and make a big deal out of it.
He can open a present for each poop in the toilet. When he poops in his pants, "Oh, that's too bad, we can't have a present this time."
I think I wrapped about 10 gifts, and he was ready when they were all gone.
It's bribery in its purest form.
Good Luck!