This really doesn't bother me at all. I've never gotten anything that resembled negative judgement for opting not to donate to a charity, and I'm secure enough in myself that I don't feel the slightest tinge of guilt for neglecting to donate money in the checkout line. Given what I know about human nature, though, it strikes me as probably a pretty good thing in a lot of ways - I suspect that a lot of people approach charitable giving as if you're expected to give a large sum of money or else it feels like it doesn't make a difference and then where do you start? How do you select a charity? Many will think "it's all too much trouble and I can't spare enough money to make a difference, so I might as well not bother." If given the choice of giving a few dollars at the grocery store, though, it takes all that out - they know that this is offered to every customer so it makes them feel that they may be able to be a part of a larger effort that does make a difference. The charity is already selected, for better or for worse, but it takes that part of the effort out of it.
Could it be done better? Absolutely. I suspect the stores are getting something of a tax break by doing this, so if they'd really like to show some altruism, they should match the donations received (or even just match 30 cents on the dollar) - this would likely motivate even more giving and they'd not be in it for a profit motive. Something tells me, though I've done no research on this, that the charities selected probably aren't the best either. But hopefully they're vetted at least a little, as the companies would probably not want a PR disaster of being revealed to support a corrupt charity. Also, I definitely think that the implementations of this where it just shows up on the keypad (vs being asked by the cashier) are somewhat nicer as they remove most of the feeling of being publicly shamed if you opt not to donate.
Similar to how people will contribute significantly more to their retirement fund if their employer requires them to opt-out of savings vs opting-in. Very small changes in how convenient something is can make a significant impact. In effect the grocery store is providing a service for those that would like it, making it easier to give and to feel that you're a part of something worthwhile. If you don't want to donate, then don't. I've never seen someone become the victim of mob violence for failure to donate money at the grocery store. I certainly don't think it's appropriate to make someone who's probably earning minimum wage working a tedious job feel uncomfortable by responding rudely because you don't like the policy of someone 6 levels up in the corporate hierarchy.
What I would suggest is if you have a problem with the policy, instead of making the poor cashier suffer for something that's not their fault, write a letter expressing your objection to the public relations office of the company. Boycott the company and order your groceries on amazon or similar if you have to. Go support a local farmer's market. Unless you live in a tiny city with one grocery store, you likely have options.