My son only poops in his pull up. Anyway to break that?

My son is 3 1/2 years old. I’ve tried bribing him with candy, toys, iPad and he still doesn’t go. One time he actually sat on the potty for nearly 2 hours. But as soon as I put that pull up on him for bed time, (he sometimes wet the bed at night. Better than washing his sheets everyday) not even 10 mins he poops and he hides. He knows he isn’t suppose to do it but is there anything else I can try without having him constipated? Also he is pee trained just not poop.