I tried my best googling on how to hide the customer IP address shown in the WooCommerce order edit pages, but no code has helped me yet. I basically just want to show the Payment method to the shop manager(i.e. : via Card Payment). I want to get rid of any other text. This question WooCommerce - Change paid text in admin panel order details page gave me some understanding on how to remove the Paid on text (ps : I replaced it with ""). But other than this, I got no clue how to hide the Customer IP address. I tried the following code, without success: add_filter( 'update_post_metadata', 'mp1401091554', 10, 3 ); function mp1401091554( $null, $id, $key ) { if ( '_customer_ip_address' === $key ) return FALSE; return $null; }
Jese Leos
September 1, 2024
Verified user
You could use some CSS to hide the customer IP address, like: add_action( 'admin_head', 'admin_edit_order_css' ); function admin_edit_order_css() { global $pagenow, $typenow; if ( ( $pagenow === 'post.php' && $typenow === 'shop_order' && isset($_GET['post']) ) || ( $pagenow === 'admin.php' && isset($_GET['page']) && $_GET['page'] === 'wc-orders' && isset($_GET['action']) && $_GET['action'] === 'edit' && isset($_GET['id']) ) ) : ?> <style> .woocommerce-Order-customerIP {display:none;} </style> <?php endif; } But it will only hide the IP address itself, but not "Customer IP:" substring. So you can use instead Javascript to remove the IP and hide "Customer IP:" substring like: add_action( 'admin_footer', 'admin_edit_order_script' ); function admin_edit_order_script() { global $pagenow, $typenow; if ( ( $pagenow === 'post.php' && $typenow === 'shop_order' && isset($_GET['post']) ) || ( $pagenow === 'admin.php' && isset($_GET['page']) && $_GET['page'] === 'wc-orders' && isset($_GET['action']) && $_GET['action'] === 'edit' && isset($_GET['id']) ) ) : ?> <script> jQuery('.woocommerce-Order-customerIP').remove(); const orderNumberMeta = jQuery('.woocommerce-order-data__meta.order_number'), orderNumberMetaHTML = orderNumberMeta.html(); orderNumberMeta.html(orderNumberMetaHTML.replace('Customer IP:', '')); </script> <?php endif; } Code goes in functions.php file of your child theme (or in a plugin). Tested and works with or without HPOS enabled. You will get something like: