Giuseppe V
Giuseppe V

Reputation: 21

Remove payment details Woocommerce order's page in backend

I see a post about to translate or change the text "Paid on" on woocommerce backend order's detail page. I integrated it for bacs and local pickup payment.

Replace a specific word for BACS payment method in Woocommerce order edit pages

What I need to add if I want not display the "Paid on" message also when shop manager before set the status to processing (so payment details appears) and then turn back to "wait for payment" or a previous status?

Image attached: Order status is Deleted but it always show the payment details from Completed status set before

enter image description here

Thanks

Update:

Black fields are done because I want to hide real customer informations because I'm sharing the screenshoot here :D

This is to replicate the problem:

I need to remove details if the order status is different from processing or completed order status.

Thanks

Upvotes: 1

Views: 1011

Answers (1)

Rajeev Singh
Rajeev Singh

Reputation: 1809

As you shared the screenshot I implemented the logic for you.

You can try this for temporary hide billing, shipping address and IP address

add_action( 'woocommerce_admin_order_data_after_order_details', 'hide_custom_details' );
function hide_custom_details($order) { 
  $status = array('processing','completed','refunded','cancelled');
  $order_status = $order->get_status();
  //if(!is_admin() && !in_array($order_status, $status)) { 
  if(!in_array($order_status, $status)) { 
  ?>
  <style> 
     #order_data .order_data_column:nth-child(2),
     #order_data .order_data_column:nth-child(3),
     #order_data .woocommerce-order-data__meta.order_number .woocommerce-Order-customerIP{ 
           display: none !important 
     } 
  </style>
 <?php } 
}

If you want to update more, so first Inspect(ctrl+shift+i) and copy class/id as you want to hide and paste inside given CSS.

If you want that, the admin can view every detail then add "!is_admin() &&" inside if the condition like commented if conditions. you can also update the status accordingly.

enter image description here

Upvotes: 1

Related Questions