Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function new_orders_columns($columns)
- {
- unset($columns['shippging_address']);
- return $columns;
- }
- function after_woo()
- {
- add_filter('manage_shop_order_posts_columns', 'new_orders_columns', 10, 1);
- }
- add_action('plugins_loaded', 'after_woo');
- add_filter( 'manage_edit-shop_order_columns', 'remove_specific_orders_column' );
- function remove_specific_orders_column( $columns ){
- unset( $columns['shipping_address'] );
- return $new_columns;
- }
- 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();
- }
- }
- $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( '#<brs*/?>#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 '–';
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement