I have given you a list of parameters that need to be filled.
$idProduct = 2; $idProductAttribute = 12; $product = new Product((int)$idProduct, false, $this->context->language->id); $link = new Link(); $linkProduct = $link->getProductLink( $product, false, false, false, $this->context->language->id, $this->context->shop->id, (int)$idProductAttribute, false, false, true, [], false );