Magento 2.3 Downloadable Products Out of Stock : Fixed !!

Magento as an ecommerce platform boasts tons of features and comes across as one of the most perfect choices in the industry. However, we know that nothing is perfect and as such Magento also tends to have some bugs. Downloadable products are an integral part of Magento that allows admin to create and display downloadable products easily. There are tons of Magento stores out there that use a huge number of downloadable products. Today we are going through an issue faced by people using Magento 2.3 downloadable products. We will go through the bug and provide the best fix possible. 

Problem:- We recently migrated our store from Magento 1 to Magento 2. Our store works with digital products on a regular basis. The newly created downloadable products in Magento 2.3 are out of stock by default. We can see the product being out of stock in both the backend and frontend. For frontend, our buy now button also disappears due to the product being out of stock. Whereas imported products work correctly. 

Cause:- Upon investigation we identified that the newly created downloadable products fail a validation check due to which it is getting set to out of stock by default. You can check the “links_exists” attribute in the “eav_attributes” table, for some reason it is getting set to 0 by default which is expected behaviour in Magento 1. However, Magento 2.3 expects NULL value for “links_exists” by default. The following validation check fails due to the value 0.


File: vendor/magento/module-downloadable/Model/Product/Type.php return $this->hasLinks($product) && parent::isSalable($product);

The issue is only limited to newly created downloadable products as the imported products have a different value for “links_exists” because of which it passes the above validation check.

Solution:- We found a simple solution to the above problem. Upon changing the default value of ‘links_exists’ attribute in ‘eav_attrribute’ table from 0 to 1 fixes the issue. We created a sql query that changes this value as you can see in the below code:-

UPDATE eav_attribute SET default_value = '1' WHERE (attribute_code = 'links_exist');

Run the above code in your database and it should fix the issue.