i found a way to achieve this with a little snippet thats add the products category to the order posts.
add_filter( 'admin_body_class', function( $class ) {
$screen = get_current_screen();
$new_classes = [
'user-' . get_current_user_id(),
];
if( 'post' === $screen->base && 'shop_order' === $screen->post_type ) {
$order = wc_get_order( get_the_ID() );
$category_classes = [];
foreach( $order->get_items() as $item_id => $item ) {
$product_id = $item->get_product_id();
$product_categories = get_the_terms( $product_id, 'product_cat' );
foreach( $product_categories as $category )
$category_classes[] = 'cat-' . $category->slug;
}
$category_classes = array_unique( $category_classes );
$new_classes = array_merge( $new_classes, $category_classes );
}
$new_classes = implode( ' ', $new_classes );
$class .= ' ' . $new_classes;
after that i simply add some admin css:
.cat-mwb_wgm_giftcard .postbox-container #woocommerce-shipment-dhl-label { display: none; }
-
This reply was modified 4 years, 3 months ago by telemarker.
-
This reply was modified 4 years, 3 months ago by telemarker.