I have only one downloadable software in my website and it consists of several parts. This is the download page screenshot after the payment is done -
Since the same product name is repeating many times, I want to remove the Product name from Download section. Moreover, I want to rearrange the other columns and make the third column (Download) as the first column. Downloads remaining and Expires columns should appear second and third.
I followed the answer mentioned in this post and put the following code in my functions.php file -
add_filter( 'woocommerce_account_downloads_columns', 'custom_downloads_columns', 10, 1 ); // Orders and account
add_filter( 'woocommerce_email_downloads_columns', 'custom_downloads_columns', 10, 1 ); // Email notifications
function custom_downloads_columns( $columns ){
// Removing "product_name" column
if(isset($columns['product_name']))
unset($columns['product_name']);
return $columns;
}
But it's not helping, it's not making any change!
Can you please help me out?
Thanks a lot in advance.
There are some mistakes and missing things, try the following instead:
add_filter( 'woocommerce_account_downloads_columns', 'custom_downloads_columns', 10, 1 ); // Orders and account
add_filter( 'woocommerce_email_downloads_columns', 'custom_downloads_columns', 10, 1 ); // Email notifications
function custom_downloads_columns( $columns ) {
// Removing "Product" column
if( isset($columns['download-product']) ) {
unset($columns['download-product']);
}
// Moving "Downloads" column as the first column
if( isset($columns['download-file']) ) {
$download_file = $columns['download-file'];
unset($columns['download-file']);
$columns = array_merge( array('download-file' => $download_file), $columns);
}
return $columns;
}
Code goes in functions.php file of your child theme (or in a plugin). Tested and works.