How to import related products using product SKUs with WooCommerce importer
You can import the related products using the default WooCommerce importer using a CSV by entering the SKUs as comma-separated in the corresponding meta columns. The sample CSV columns are as shown below:
You can insert the following code snippet into the functions.php file of the active child theme to import related products on the basis of SKU.
Alternatively, if you need to import related products on the basis of ID, refer here.