code not working after activating HPOS
-
i use below 2 codes to control the visibility of order status dropdown menu on the bulk order page and single order page, but these codes are not working after activating HPOS.
code 1
add_filter( 'bulk_actions-edit-shop_order', 'filter_dropdown_bulk_actions_shop_order', 20, 1 ); function filter_dropdown_bulk_actions_shop_order( $actions ) { $new_actions = []; foreach( $actions as $key => $option ){ // Targeting "shop_manager" | order statuses "completed" if( current_user_can('shop_manager') && in_array( $key, array('mark_completed') ) ){ $new_actions[$key] = $option; } } if( sizeof($new_actions) > 0 ) { return $new_actions; } return $actions; }
code 2
add_filter('wc_order_statuses', 'filter_order_statuses'); function filter_order_statuses($order_statuses) { global $pagenow; if( $pagenow === 'post.php' || $pagenow === 'post-new.php' ) { $new_order_statuses = array(); foreach ($order_statuses as $key => $option ) { // Targeting "shop_manager" | order statuses "completed" if( current_user_can('shop_manager') && in_array( $key, array('wc-completed') ) ){ $new_order_statuses[$key] = $option; } } if( sizeof($new_order_statuses) > 0 ) { return $new_order_statuses; } } return $order_statuses; }
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘code not working after activating HPOS’ is closed to new replies.