I’m a firm believer in having a few mantras that your child hears over and over (backed up with behavior that bears them out, of course). Here are the ones we’ve used:
Whining doesn’t work.
Parents always win.
It’s nice to be smart, but it’s smart to be nice.
The first two sound like they might help you - but only if you proceed to demonstrate that they are indeed true - whining DOESN’T work.
The advantage of repeating exactly the same phrases over a long period of time are numerous - for one thing, your kid gets the message: this is what is important. Secondly, it makes it easy to follow - you can just say, in a matter-of-fact tone “You know the rule in our family: whining doesn’t work. We’re leaving now and that’s that.” No screaming needed, and I think it helps the parent to feel grounded as well (there might have been times when I was tempted to be swayed by whining, but I knew the family rule: whining doesn’t work).
One thing I’d like to clarify though - you say this is a new/intensified behavior that seems to be related to his parents’ separating? If the link is clear, than the best thing you can do for him is provide loving discipline and boundaries.
On the other hand, if he has always been unusually fragile, and you don’t think that parenting styles have contributed to it, you might want to have him evaluated by a pediatric specialist just to make sure there is not some developmental concern present that you should know about.