Inventory every old URL
No single source lists them all: combine the old sitemap, a crawl, search console exports and server logs, because each misses something. The inventory is the job — a URL that is not on the list becomes a 404.
Match what you can mechanically
Products that exist on both sides should redirect straight to themselves, which needs stable identifiers. When Shopflooring moved off WooCommerce, over 23,000 of its 36,786 legacy URLs went straight to the same product, because the catalogue had already been matched on exact SKU.
Give the rest a real destination
The remainder go to a search result or brand page someone has checked the catalogue can answer. Sending everything to the homepage is worse than a 404, and search engines treat an irrelevant redirect as a soft 404 anyway.
Verify before the DNS changes
Once the record moves there is no old site to compare against. Run the map as a test suite against the new site on its pre-launch host: each old URL returns a 301, the destination matches, and the destination returns 200. Shopflooring's check came back 300 for 300 against production.
The full method is in the guide to replatforming a large catalogue.