Client had product data in a messy spreadsheet that the standard WooCommerce importer could not handle. Wrote a custom PHP script to clean and import the data.
The Script
Used wp_insert_post() and update_post_meta() to create products with proper SKUs, prices, stock levels, and category assignments.
Challenges
The source data had inconsistent category names and missing images. Added fuzzy matching for categories and placeholder images for products without photos.
Result
All 2,000 products imported in about 15 minutes. Client happy.