https://www.psychologytoday.com/us/blog/how-do-you-know/2020...
Whatever you think of willpower, I think controlling the food environment (don't bring it home from the store, don't eat at restaurants with mainly junk food, etc) is the most effective intervention. After that, things like substitution, delay, smallest possible portion, and putting the tempting food in an inconvenient location may help.
But if you have junk food in your home some people (like myself) will eat it compulsively at some point.
If one can make it through the sugar detox phase then it's pretty easy because the cravings do go away.
The other part is stress management; when something bad happens it's so tempting to say "fuck it, I deserve this <insert bad thing>". That's the harder part.