Looks like situational awareness was low in both incidents.
Carrying is not the only, or the best, defense against robbery. It can be very helpful or even necessary if you get caught.
Keep your mind on what's going on out there. Or have someone designated to do that while you shop. Not a bodyguard, just a set of eyes and ears while yours are busy elsewere.