Jason
Jason

Reputation: 1141

How to add a column to the downloads table in WooCommerce /my-account/downloads/

I am trying to add an additional column to the downloads table when the user goes to XXXX.COM/my-account/downloads/

woocommerce/myaccount/downloads.php gives this

<?php do_action( 'woocommerce_before_available_downloads' ); ?>

    <?php do_action( 'woocommerce_available_downloads', $downloads ); ?>

    <?php do_action( 'woocommerce_after_available_downloads' ); ?>

but I need to add a column to the actual table.

Does anyone know which template file this can be found in?

Upvotes: 1

Views: 983

Answers (1)

Ususipse
Ususipse

Reputation: 321

Follow the action. The second action in your list with the $downloads argument (that can possibly be filtered to accomplish your goal) calls woocommerce_order_downloads_table. You grep the creation of the action woocommerce_available_downloads to see so.

In the woocommerce_order_downloads_table callback you see how you can apply a filter and also the relative directory of the template you are looking for.

function woocommerce_order_downloads_table( $downloads ) {
    if ( ! $downloads ) {
        return;
    }
    wc_get_template(
        'order/order-downloads.php',
        array(
            'downloads' => $downloads,
        )
    );
}

So the short answer is woocommerce/templates/order/order-downloads.php

Upvotes: 1

Related Questions