How can I disable the download product link after one click in WooCommerce processing email

Viewed 207

Currently, the customer receives the WooCommerce order processing confirmation email post purchase which includes the download link, this is fine but the link remains active after the download has finished and when the download limit is set to 1.

I don't want this link to be used more than once otherwise the email could just be shared to download the product.

I would like it do disable after one click, I have tried various javascript code to achieve this but none have worked. The file download limit does not appear to have any effect on the email link as it is set to 1 already.

Does anyone know how to disable this link after click?

The WooCommerce email in question is email-downloads.php and the section of code for this is here:

case 'download-file':
    ?>
    <a href="<?php echo esc_url( $download['download_url'] ); ?>" class="woocommerce-MyAccount-downloads-file button alt"><?php echo esc_html( $download['download_name'] ); ?></a>
    <?php
    break;
case 'download-expires':
    if ( ! empty( $download['access_expires'] ) ) {
        ?>
0 Answers
Related