1
votes

I'm using WordPress + Woocommerce for one project. The problem is that the CSV file from the client has over 650k records for products and I have to upload all these products to woocommerce store.

Wordpress using 2 tables (wp_posts, wp_postmeta) for products and 3 tables(wp_terms, wp_term_taxonomy, wp_term_relationships) for categories and tags. All products should be uploaded as just simple woocommerce products.

Not sure what could be the best option for such data migration.

I tried to use a WordPress import plugin for this (WP All Import) but it was taking too much time.

By using this script (largeCSV2mySQL) I was able to import 650k products info to the database table in less than 10s. Is there anyway to import all those 650k products to woocommerce store in such a fast way?

What could be the best experience to handle such huge data?

2
Questions seeking debugging help ("why isn't this code working?") must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Questions without a clear problem statement are not useful to other readers. See: How to create a Minimal, Reproducible Example.sao
@sao, I just updated my question, I was able to import 650k products to another table using that largeCSV2mySQL script but not as woo-commerce products. only took around 10s using this script. I just want to know is there a way to import the same amount records to woocommerce store using wp-cli or any php script etc??brucelin

2 Answers

0
votes

I recommend creating a function that retrieves the data from the file and sends it to WordPress/Woocommerce with wp_insert_post and the post_type 'product'.

0
votes

I highly recommend using the Woocommerce REST API to perform the population of the data. You'll definitely need to write code to process your file by utilizing the CRUD actions available to you. The REST API handles most of the heavy lifting, all you need to do is read the data from your file and fit it to the API.

If you do have a large number of products to import, and it's all in a single file, try composing your importer to only process a range of lines (can do with with command line parameters). That would allow you to run the import in multiple terminals and split the load, rather than having to write something that's multithreaded using pthreads.