Add Name and SKU Main Product to Secondary Product to Cart

I would therefore create a new short code based on the existing one

https://docs.woocommerce.com/wc-apidocs/source-class-WC_Shortcodes.html#295

Where before adding the product (sample) to the shopping cart the values ​​of the sample product will be updated with the values ​​of the (main) product.

then you could using something like this

$product = wc_get_product( $product_id );
$product->set_sku( 1234 );
$product->save();
href=”http://yourdomain.com/?add-to-cart=product_id″