Shoplifting cases are often charged as violations of Penal Code section 459.5(a).
To prove you guilty, the DA must show:
You entered a commercial establishment;
You did so with the specific intent to commit larceny (theft);
The commercial establishment was open during regular business hours; and
The value of the property taken did not exceed $950.
These cases used to charged as commercial burglaries -- violations of Penal Code section 459. The courts were flooded with petty shoplifting cases dressed up as burglaries. A burglary conviction, even as a misdemeanor, looked bad on folks' criminal records. In 2014, a voter initiative led to the creation of, among other things, Penal Code section 459.5, shoplifting.
By far the most effective defense is arguing that you did not have the intent to steal at the time you entered the store. DAs prove your intent by showing the circumstances. For example, if you grabbed various items, hid them, walked out the store without paying, and didn't have any money on you, then you're going to look pretty guilty to a jury. Of course, if you admitted you entered the store intending to steal, you've shot yourself in the foot.
But, there are a lot of cases where it's vague whether your intent to steal occurred after you entered the store. In other words, you could enter fully intending to shop in a legal manner and then see something that catches your attention and try to sneak out without paying. In such an instance, you are not guilty of shoplifting under Penal Code section 459.5. You would be, however, guilty of basic petty theft, a violation of Penal Code section 484. The point is, if the DA prosecutes you under section 459.5, even if you so plainly stole, even if it's on video, etc., it's possible to still walk away not guilty if your case proceeded to trial.