I tried using the code below to add custom text to WooCommerce My account Orders inside the Action column: add_action('woocommerce_my_account_my_orders_column_order-actions', 'add_account_orders_column_rows'); function add_account_orders_column_rows($order) { echo "TEST"; } But it replace the default action buttons functionality, with my custom text, like: I would like to keep the action buttons and my custom text. How can we achieve this?
Jese Leos
October 1, 2024
Verified user
You missed adding some code to output action buttons, as the hook you are using in your code, replace the action buttons on the template myaccount/orders.php. Try the following revisited code: add_action('woocommerce_my_account_my_orders_column_order-actions', 'my_account_my_orders_column_order_actions_additional_content'); function my_account_my_orders_column_order_actions_additional_content( $order ) { $actions = wc_get_account_orders_actions( $order ); $btn_class = wc_wp_theme_get_element_class_name( 'button' ) ? ' ' . wc_wp_theme_get_element_class_name( 'button' ) : ''; if ( ! empty( $actions ) ) { foreach ( $actions as $key => $action ) { // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited /* translators: %s: order number */ echo '<a href="' . esc_url( $action['url'] ) . '" class="woocommerce-button' . esc_attr( $btn_class ) . ' button ' . sanitize_html_class( $key ) . '" aria-label="' . esc_attr( sprintf( __( 'View order number %s', 'woocommerce' ), $order->get_order_number() ) ) . '">' . esc_html( $action['name'] ) . '</a>'; } } // Your content echo "TEST"; } You will get something like: Related: Customize completely WooCommerce My account Orders section Remove cancel button from WooCommerce My account Orders conditionally Change view button text in Woocommerce My account orders table