add in my orders the number of points earned
add_filter( 'woocommerce_my_account_my_orders_columns', 'ywpar_woocommerce_my_account_my_orders_columns' );
add_filter( 'woocommerce_my_account_my_orders_column_order-points', 'woocommerce_my_account_my_orders_column_order_total', 10);
function ywpar_woocommerce_my_account_my_orders_columns( $columns ) {
$new_columns = array();
foreach ( $columns as $index => $column ) {
if ( $index == 'order-total' ) {
$new_columns ['order-points'] = __( 'Points', 'text-domain' );
}
$new_columns[ $index ] = $column;
}
return $new_columns;
}
function woocommerce_my_account_my_orders_column_order_total( $order ) {
if( ! $order ){
return '-';
}
$points = get_post_meta( $order->id, '_ywpar_points_earned', true );
echo $points ? $points : 0;
}