Skip to content
Advertisement

How to fix php shortcode to show woocommerce download button

I am trying to view the download button belonging to the last order placed by a customer. Basically I have this code. It worked for other things like: displaying the purchase date, order total, product name etc, but it doesn’t work with the downlad.

JavaScript

return $last_order->get_downloadable_items(); it shows the word array instead of the download button. Could someone tell me where am I wrong? Excuse me, but I am relatively new to php.

// Edit – With probable solution //

Maybe I have found a solution. I modified the code by adding wc_get_template and array. This works well for users who have a download available. Unfortunately, however, users who have not made any purchases and therefore do not have a download available find themselves with a broken layout.

Is there any way to display an error message? or to correct this in any other way?

JavaScript

Advertisement

Answer

JavaScript
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement