Thanks to QR Codes, Ditto's location has been found in Sun and Moon. All you have to do is visit the right island, scrounge around the correct route, and bring tons of extra Pokeballs. Beware, Ditto won't join your party without a fight, and his catch rate is lower than in other Pokemon core entries.