I'm working with Magento 2, I have one product in cart and I want to show related products for cart products. I get current product using the quote to get all items. Once I have fetched current product's ID and object. Now, I want show related products using current product. Below is my code.
$relatedProducts = $currentProduct->getRelatedProducts();
I am able to get related products using above code, but related product showing by created product ID using my above code. I want show related products based on selection of related product. I want show first two selected related products from related 10 products. Is there any way to get first selected related products not by ID