This is great advice. When you want a behavior to decrease, if you don’t offer a replacement behavior, you’re likely doomed to failure. In this case, replacing hitting with hugging is a great idea. Also, punishing undesirable behavior just doesn’t work as well as rewarding desirable behavior.
Using a token economy system, you can link earning five stars with a highly preferred reward, for example, but you need to figure out what motivates your child (Food/sweets? Access to an activity like TV or a game?) Tell them they’ll earn this reward every day when they earn 5 stars, and they earn a star by not hitting, and lose a star when they hit.
The first time through, lay the stars on thick and quick. Make a big deal of earning each star, "great job!! You didn’t hit and you earned a star! And show them while you write it down. Give them the reward immediately after earning five stars. If they’re reliably earning their stars, space the stars out over time so that it takes more time to earn them.
If they hit, calmly and dispassionately tell them they lost a star and show them you scratching it off, then completely withdraw your attention. It’s very important not to continue to accidentally reinforce hitting behavior with attention. If your child is getting a big reaction from someone when they hit, even if it’s a negative reaction, it’s very likely perpetuating the behavior.
“Ignore the behavior” is a radical oversimplification. A better approach would be to make sure you’ve developed the skills in yourself to remain completely calm and unaffected when a tantrum happens, then you make yourself present but calm and uninterested until the child calms down, at which point you immediately reward them being calm with affection and attention, or whatever it is they would perceive as a reward. Without the reward part, ignoring a negative behavior risks worsening it over time. Also this is clearly not always possible, eg if you’re in a public setting or if the child is doing something dangerous.
Also for OP, it sounds like y’all have been giving this a lot of attention. Be careful not to let your anxiety become hers