简体   繁体   中英

Change column name in Downloads section from email notifications in Woocommerce

I'm creating a website with downloadable products with WooCommerce. When users buy a product and receive an email, I want to customize the table of downloadable products in the email. More specific I only want to change the following:

Only thing I want to do is change 'Downloads' and 'download' to something else… 截屏

With some research, I thought I had the answer. I changed some things in order/order-details.php and order/order-downloads.php . But I think I didn't do it correctly.

Can someone tell me what I have to change exactly?

To change the title "Downloads" , the right template involved is emails/email-downloads.php line 22

?><h2 class="woocommerce-order-downloads__title"><?php esc_html_e( 'Downloads', 'woocommerce' ); ?></h2>

To change the column label name "Download" , you will use the following code:

add_filter('woocommerce_email_downloads_columns', 'custom_email_downloads_columns', 10, 1);
function custom_email_downloads_columns( $columns ){
    $columns['download-file'] = __("New name", "woocommerce");

    return $columns;
}

Code goes in function.php file of your active child theme (or active theme). Tested and work.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM