Skip Navigation

[Resolved] Displaying Downloadable Files from WooCommerce Products

This thread is resolved. Here is a description of the problem and solution.

Problem:

I would like to display the downloadable files that are associated with a WooCommerce product using Layouts (I've created a custom layout for the product). I've found the _downloadable_files custom field, which displays the file names, but adding an Add to Cart button creates nothing (no add to cart button, no download button). Please advise.

Solution:

There isn't such a built-in feature within Toolset plugins, I have tested it in my localhost:

Woocommerce plugin is using a custom field "_downloadable_files" to store the downloadable file information, the field value is in serialized array format, so it needs custom codes to convert it to shortcodes to links, see details here:

https://toolset.com/forums/topic/displaying-downloadable-files-from-woocommerce-products/#post-1179849

Relevant Documentation:

This support ticket is created 5 years, 3 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 4 replies, has 2 voices.

Last updated by damianS-2 5 years, 3 months ago.

Assisted by: Luo Yang.

Author
Posts
#1179834

I would like to display the downloadable files that are associated with a WooCommerce product using Layouts (I've created a custom layout for the product). I've found the _downloadable_files custom field, which displays the file names, but adding an Add to Cart button creates nothing (no add to cart button, no download button). Please advise.

#1179849

Hello,

There isn't such a built-in feature within Toolset plugins, I have tested it in my localhost:
Woocommerce plugin is using a custom field "_downloadable_files" to store the downloadable file information, the field value is in serialized array format, for example:

a:1:{s:36:"923cd58e-c986-451d-9d25-ec7d9857ca5b";a:3:{s:2:"id";s:36:"923cd58e-c986-451d-9d25-ec7d9857ca5b";s:4:"name";s:4:"abcd";s:4:"file";s:62:"<em><u>hidden link</u></em>";}}

So it needs custom codes to convert it to shortcodes to links, I have searched it in google, and found this plugin:
https://wordpress.org/plugins/woocommerce-my-downloads-shortcode/

It can add the short code [woocommerce-my-downloads] to display the download links

#1179910

Hi Luo,

Thanks, I realize the data is serialized. I tried using that plugin but it isn't displaying anything on the product page when I use it in a layout. Does it work at all on your installation of WooCommerce?

#1179945

I have tested that plugin, the shortcodes works after you have purchased the product, but it also produce some PHP warning message, and that plugin is only for your reference, it is not our product.

#1180698

My issue is resolved now. Thank you!

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.