The correct filter hook to be used is manage_edit-shop_order_columns
.
1) To remove shipping_address
column:
add_filter( 'manage_edit-shop_order_columns', 'remove_specific_orders_column' );
function remove_specific_orders_column( $columns ){
unset( $columns['shipping_address'] );
return $new_columns;
}
Code goes in functions.php file of the active child theme (or active theme). Tested and works.
2) Replace the content of shipping_address
column:
Here is an example that will replace the column “Shipping address” content from Admin Orders list:
add_filter( 'manage_edit-shop_order_columns', 'customizing_orders_columns' );
function customizing_orders_columns( $columns ){
$new_columns = [];
foreach ( $columns as $key => $column ) {
if( $key === 'shipping_address' ) {
$new_columns['shipping_addr_repl'] = $column;
} else {
$new_columns[$key] = $column;
}
}
return $new_columns;
}
add_action( 'manage_shop_order_posts_custom_column', 'set_custom_shipping_address_content_replacement' );
function set_custom_shipping_address_content_replacement( $column ) {
global $the_order, $post;
if ( 'shipping_addr_repl' === $column ) {
// YOUR REPLACEMENT CODE (Fake example below)
echo $the_order->get_shipping_city();
}
}
Code goes in functions.php file of the active child theme (or active theme). Tested and works.
The original displayed content code for this column is:
$address = $the_order->get_formatted_shipping_address();
if ( $address ) {
echo '<a target="_blank" href="' . esc_url( $the_order->get_shipping_address_map_url() ) . '">' . esc_html( preg_replace( '#<br\s*/?>#i', ', ', $address ) ) . '</a>';
if ( $the_order->get_shipping_method() ) {
/* translators: %s: shipping method */
echo '<span class="description">' . sprintf( __( 'via %s', 'woocommerce' ), esc_html( $the_order->get_shipping_method() ) ) . '</span>'; // WPCS: XSS ok.
}
} else {
echo '–';
}