0

I'm making a skin for The Grid plugin (https://theme-one.com/docs/the-grid/#developer_guide).

All the products are virtual and downloadable — I've managed to make an add to cart function, but need to download products instantly too. Is there a meta key for the file url (combed the database and couldn't spot one) or a way to get it?

Currently I've got something that just returns an array:

$output .= '<p><a href="' . $tg_el->get_item_meta('_downloadable_files') . '" download target="_blank"><i class="fa fa-download"></i> Download Image</a></p>';

Thought I'd found a possible solution: https://wordpress.stackexchange.com/a/199884/134263 but am not great with php and I'm unsure how to implement it.

Any pointers would be much appreciated!

0
<?php                                           
    $downloads = $product->get_files();
    foreach( $downloads as $key => $each_download ) {
        echo '<p><a href="'.$each_download["file"].'" download><i class="fa fa-download"></i> Download Image</a></p>';
    }
?>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.