I would like to customize My account > Orders page, changing from action column, the "view" button text to "view tickets" in the Orders list table.
Is it possible to do it only on My account > Orders page?
Here is a screenshot for clarifications:
To rename My account > Orders: "view" action button text, use the following:
// Rename My account > Orders "view" action button text
add_filter( 'woocommerce_my_account_my_orders_actions', 'change_my_account_my_orders_view_text_button', 10, 2 );
function change_my_account_my_orders_view_text_button( $actions, $order ) {
$actions['view']['name'] = __( 'View ticket', 'woocommerce' );
return $actions;
}
To Rename My account "Orders" menu item, use the following (if needed):
// Rename My account "Orders" menu item
add_filter( 'woocommerce_account_menu_items', 'rename_my_account_orders_menu_item', 22, 1 );
function rename_my_account_orders_menu_item( $items ) {
$items['orders'] = __("Ticket Orders", "woocommerce");
return $items;
}
Code goes in function.php
file of your active child theme (or active theme). Tested and works.
If you need to target only My account > "orders" table, use is_wc_endpoint_url('orders')
conditional tag:
// Rename My account > Orders "view" action button text
add_filter( 'woocommerce_my_account_my_orders_actions', 'change_my_account_my_orders_view_text_button', 10, 2 );
function change_my_account_my_orders_view_text_button( $actions, $order ) {
if( is_wc_endpoint_url( 'orders' ) )
$actions['view']['name'] = __( 'View ticket', 'woocommerce' );
return $actions;
}
Code goes in function.php
file of your active child theme (or active theme). Tested and works.