As of today there is no official guide for this simple need. If you have old orders more than 1000, you are right if you want to get rid of old orders – just to fasten your website.
So i decided to write my own script and apply to my web store with 30K order history.
Step1: I activated HPOS in dual-mode (aka safe mode).
Step2: 1 day passed and i disabled legacy mode and kept HPOS only
Step3: 1 more day passed and i deleted the oldest 5 orders from wp_postmeta.
Step4: Everything looked good, and i did the same for all orders.
Warning: You should take a backup before applying this code:
Continue reading “How to Clean POSTMETA Data of Old Orders After Switching to WooCommerce HPOS”