Hide order product from woocommerce admin order details page

Viewed 315

I am looking for the way to hide the hidden product from the admin order details page. I value of order product is $0. So i want to remove this from the order details page. I am using this for show the shipping method with the conditional shipping plugin from the Woocommece so i dont want to show it for admin.

I did hide for cart,checkout, order details for customer and order email. So looking for the solution of admin order details page.

Here is some code snippet which i used for hide the product for cart,checkout, order details for customer and order email

add_filter( 'woocommerce_cart_item_visible', 'hide_ship_product_from_cart' , 10, 3 );
add_filter( 'woocommerce_widget_cart_item_visible', 'hide_ship_product_from_cart', 10, 3 );
add_filter( 'woocommerce_checkout_cart_item_visible', 'hide_ship_product_from_cart', 10, 3 );
add_filter( 'woocommerce_order_item_visible', 'hide_ship_product_from_order_details', 10, 2 );
function hide_ship_product_from_cart( $visible, $cart_item, $cart_item_key ) {
   $product = apply_filters( 'woocommerce_cart_item_product', $cart_item['data'], $cart_item, 
                            $cart_item_key );
   if ( $product->get_shipping_class() == 'delivery'  || $product->get_shipping_class() == 'pickup' ) 
       {
          $visible = false;
       }
          return $visible;
   }


 function hide_ship_product_from_order_details( $visible, $order_item ) {
 $product = $order_item->get_product();
 if ( $product->get_shipping_class() == 'delivery' || $product->get_shipping_class() == 'pickup' ) {
       $visible = false;
   }
   return $visible;
  }

I want to hide the order item from the admin order page. enter image description here

0 Answers
Related