I am trying to add a column that displays the ‘Ship to’ company name to the WooCommerce > my account > orders page.
So far the code below adds a column but how do I get the ‘Ship to’ data to show, where am I’m I getting it wrong?
// Add new column(s) to the "My Orders" table in the account.
function filter_woocommerce_account_orders_columns( $columns ) {
$columns['custom-column'] = __( 'New Column 1', '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_shipping_company_column( $order ) {
echo 'New Column 1';
}
add_action( 'woocommerce_my_account_my_orders_column_custom-column', 'filter_woocommerce_my_account_my_orders_column_custom_column', 10, 1 );
$order_shipping_company = $order_data['shipping']['company'];
2
Answers
I discovered it : FINALLY !!
You can use
woocommerce_my_account_my_orders_query
filter hook. You have to pass a number of orders you want to display tonumberposts
param. try below code.