Код: Выделить всё
// **********local pickup orders list color**********
function filter_post_class( $classes, $class, $post_id ) {
// Determines whether the current request is for an administrative interface page
if ( ! is_admin() ) return $classes;
// Get the current screen object
$current_screen = get_current_screen();
// Only when
if ( $current_screen->id === 'edit-shop_order' ) {
// Get an instance of the WC_Order object
$order = wc_get_order( $post_id );
// Is a WC_Order
if ( is_a( $order, 'WC_Order' ) ) {
// Get the shipping method
// $shipping_method = $order->get_shipping_methods();
$shipping_method = @array_shift($order->get_shipping_methods());
$shipping_method_id = $shipping_method['method_id'];
//NOT empty
if ( ! empty( $shipping_method ) ) {
$classes[] = $shipping_method_id;
}
}
}
// Return the array
return $classes;
}
add_filter( 'post_class', 'filter_post_class', 10, 3 );
// Add CSS
function action_admin_head() {
// Get the current screen object
$current_screen = get_current_screen();
// Only when
if ( $current_screen->id === 'edit-shop_order' ) {
echo '
.type-shop_order.local_pickup {
background-color: #d5d6ad !important;
}
';
}
}
add_action( 'admin_head', 'action_admin_head' );
Woocommerce Dashboard - Выделите заказы, отмеченные «локальный пикап»
Но никто не работает.
>
Подробнее здесь: https://stackoverflow.com/questions/795 ... ing-method