How to import products to Woo Commerce given that WP All Import keeps timing out

I assume that you want to create your own import plugin here.

The reason that your server timing-out is possible due exporting all products in one request.

So, what I will do for that scenario is by using ajax import. Instead of trying to save all data in one go, you can use ajax to store the product one-by-one.