Coprophagia can be a symptom of stress, anxiety or boredom. Has something changed in your home - the people who live there, have you moved houses, are you around more (or less) than usual? It sounds like something has disrupted her lifestyle and she is reacting. And I would definitely have her health checked because that can cause it. One way you might try to get her to stop is to add pineapple to her diet. I've seen the suggestion several times on Yorkie Talk and you will also find it in the article below. Hitting your dog could also be the
cause of the problem vs. the "punishment" as you suggest. This is not the right way to punish a dog, ever. They can't make the connection between the behavior and the repercussion (getting whacked). You are only going to make her fearful of you.
Fortunately, I never had this problem, but my girlfriend did with her 2 puppies and we found this site very helpful:
Stop Dogs Eating Dog Poop - Coprophagia stop your puppy eating dog feces or poo