Support

Account

Home Forums General Issues How do I get the woocommerce downloadable file size?

Unread

How do I get the woocommerce downloadable file size?

  • meta.php

    Can add the following code to achieve
    How should ACF get the file size?

    <?php

    global $product;

    $downloads = $product->get_files();

    foreach( $downloads as $key => $each_download ) {
    $ProductID = attachment_url_to_postid( $each_download[“file”] );
    $path = get_attached_file( $ProductID );
    }

    echo ‘<p> size: ‘. size_format(filesize($path)) .'</p>’;

    ?>

Viewing 1 post (of 1 total)

The topic ‘How do I get the woocommerce downloadable file size?’ is closed to new replies.