How to get Downloadable Product Links data from product object Magento 2?

Retrieve getDownloadableProductLinks() from the Product object in Magento 2 to fetch download product links information.

Core module module-downloadable contains the extension attributes type for the Magento\Catalog\Api\Data\ProductInterface. Attribute code downloadable_product_links used for the links details in the product object.

<attribute code="downloadable_product_links" type="Magento\Downloadable\Api\Data\LinkInterface[]" />

You need to fetch product object, check product with getExtensionAttributes() value and product type downloadable contains the method getDownloadableProductLinks().

namespace Jesadiya\Links\Model;

use Magento\Catalog\Api\ProductRepositoryInterface;
use Magento\Framework\Exception\NoSuchEntityException;
use Psr\Log\LoggerInterface;

class LinksByProduct
     * @var ProductRepositoryInterface
    private $productRepository;

     * @var LoggerInterface
    private $logger;

    public function __construct(
        LoggerInterface $logger,
        ProductRepositoryInterface $productRepository
    ) {
        $this->logger = $logger;
        $this->productRepository = $productRepository;

     * Get links array of Downloadable Product.
     * @param string $sku
     * @return array
    public function downloadableLinksByProduct(string $sku): array
        $linksData = [];
        try {
            $product = $this->productRepository->get($sku);
            if ($product->getExtensionAttributes() && $product->getExtensionAttributes()->getDownloadableProductLinks()) {
                foreach ($product->getExtensionAttributes()->getDownloadableProductLinks() as $links) {
                    $linksData[] = $links->getData();
        } catch (NoSuchEntityException $exception) {

        return $linksData;

Call from the template,

$sku = '240-LV09'; //Downloadable sku
$linksArray = $this->downloadableLinksByProduct($sku);

Using the above way, You can get downloadable links from the Product object.

You can explore also, How to get all downloadable links details from the Downloadable Product Magento 2?