I want to add two custom columns on my orders page. The columns display the title instead of the data. I am novice and can not find my mistakes.
`// Add new column(s) to the "My Orders" table in the account.
function filter_woocommerce_account_orders_columns( $columns ) {
$columns['pi_delivery_date'] = __( 'Delivery date', 'woocommerce' );
$columns['pi_delivery_time'] = __( 'Delivery time', 'woocommerce' );
return $columns;
}
add_filter( 'woocommerce_account_orders_columns',
'filter_woocommerce_account_orders_columns', 10, 1 );
// Adds data to the custom column in "My Account > Orders"
function
filter_woocommerce_my_account_my_orders_column_pi_delivery_date( $order) {
if ( $value = $order->get_meta( '_pi_delivery_date' ) ) {
echo esc_html( $value );
}
}
add_action( 'woocommerce_my_account_my_orders_column_pi_delivery_date', 'filter_woocommerce_my_account_my_orders_column_pi_delivery_date', 10, 1 );
// Adds data to the custom column in "My Account > Orders"
function filter_woocommerce_my_account_my_orders_column_pi_delivery_time( $order ) {
if ( $value = $order->get_meta( '_pi_delivery_time' ) ) {
echo esc_html( $value );
}
}
add_action( 'woocommerce_my_account_my_orders_column_pi_delivery_time', 'filter_woocommerce_my_account_my_orders_column_pi_delivery_time', 10, 1 );`