We have a multisite where the main site contains "all" products. Each sub-site is its own store with its own products.
Products in the sub sites are created using a React application where users log in, pick one or more products (list generated from all products on main site), and click "Add" in order to add them to their own site (again, a sub-site). We're essentially re-creating a product from one site into another using the data fetched by React from the main site, using built-in Woo REST routes.
This all works fine, however we're running into performance issues.
When "cloning" a product that has 20 or so variations into a sub-site, not all variations are created. Eventually is times out and the variation creation stops.
We've tried batching them as low as 3 at a time, but it doesn't work - it still times out.
The endpoint's we're using
POST /wp-json/wc/v3/products- Create a product
POST /wp-json/wc/v3/products/<product_id>/variations- Create variations
So my question is this: Should this be done in a different way? Is there a more efficient way of adding products than using built-in REST routes? We can of course create custom endpoints, but that won't help unless we identify where in the default endpoint optimizations can be made. My worry is that Woo is simply too slow in creating products in order for this application to even work as intended.