🔥 Just Launched! Werra Premium Template for HyväSee it in Action

How to Get Selected Downloadable Product Options from Order Items in Magento 2? 

By Sanjay JethvaUpdated on Jun 05, 2025 3 min read

While creating downloadable products in Magento 2, there’s an important setting that determines how customers access the downloadable files: “Links Purchased Separately.”

This setting defines whether customers can purchase individual links or only as a complete bundle.

Enable Links Purchased Separately

If you enable this option by checking the box, each downloadable link will be treated as a separate item. This allows customers to select and purchase only the specific files they want.

This option can be useful when you are selling a digital product like a course, media content or a software module. 

If you’re selling an entire course as a downloadable product and want to give customers the option to buy just one specific lesson instead of the whole course, this feature is helpful. 

As a Magento developer, you may often need to retrieve the exact downloadable options selected by a customer for a particular order item via code. This becomes essential in scenarios such as:

  • Displaying downloadable links in the customer’s order history
  • Indicating which downloadable files were purchased
  • Including this information in PDF invoices
  • Developing backend or frontend features that rely on this data
  • Adding downloadable link titles in order confirmation emails

How to Get Selected Downloadable Product Options from Order Items in Magento 2? 

Integrate the below solution to get access to this option.

$objectManager = \Magento\Framework\App\ObjectManager::getInstance();

if($_item->getProduct()->getTypeId() == 'downloadable'){
$purchased = $objectManager->create('Magento\Downloadable\Model\Link\PurchasedFactory')->create()->load($_item->getId(), 'order_item_id');
                    $purchasedItemCollectionFactory = $objectManager->create('Magento\Downloadable\Model\ResourceModel\Link\Purchased\Item\CollectionFactory');
                    $purchasedItems = $purchasedItemCollectionFactory->create()
                        ->addFieldToFilter('order_item_id', $_item->getId());

                    foreach ($purchasedItems as $purchasedItem) {
                        $downloadableItems[] = [
                            'link_title' => $purchased->getLinkSectionTitle(),
                            'option_title' => $purchasedItem->getLinkTitle()
                        ];
                    }
}

Here, $_items is an object of the Sales Order Item.

The above code populates the $downloadableItems array with titles of each downloadable file linked to the order item.

Simply, use this solution to get selected downloadable product options from order items in Magento 2.

Sanjay Jethva Full Image
Article bySanjay Jethva

Sanjay is the co-founder and CTO of Meetanshi with hands-on expertise with Magento since 2011. He specializes in complex development, integrations, extensions, and customizations. Sanjay is one the top 50 contributor to the Magento community and is recognized by Adobe. His passion for Magento 2 and Shopify solutions has made him a trusted source for businesses seeking to optimize their online stores. He loves sharing technical solutions related to Magento 2 & Shopify.