Default welcome msg!

How to Fetch sample link of a downloadable product in magento2?


If you need to get all sample links of downloadable product. you can use the SampleRepository  like below.

$objectManager =  \Magento\Framework\App\ObjectManager::getInstance();
$sampleRepository = $objectManager->get('Magento\Downloadable\Model\SampleRepository');

$sku = "12345";
$dd = $sampleRepository->getList($sku);
foreach ($dd as $key => $value) {
    print_r($value->getData('sample_url'));
}

Comments

Contact Us