Have you ever encountered a situation where the checkboxes or “Bulk Actions” dropdown on the WooCommerce Orders page suddenly disappear for your Shop Managers? This often happens when a plugin conflict erroneously clears the available actions for non-admin users.
We can implement a “fail-safe” to ensure that for specific roles, the bulk actions list is never empty.
The Fail-Safe Snippet (MU-Plugin Method)
The most reliable way to implement this is as a Must-Use Plugin (MU-Plugin). This ensures the code runs before normal plugins and cannot be disabled by accident.
- Create a file named
00-dicky-woocommerce-bulk-failsafe.phpin your/wp-content/mu-plugins/directory.- If the
mu-pluginsdirectory doesn’t exist, create it inside/wp-content/.
- If the
- Paste the following code into that file:
<?php
/**
* Snippet Name: WooCommerce Bulk Action Fail-Safe
* Description: Forces bulk actions (like 'Edit') to appear for Shop Managers even if other plugins try to unset them.
* Version: 1.0.0
* Author: Dicky Ibrohim
* Author URI: https://www.dickyibrohim.com
*/
// We use a very high priority (9999) to ensure this runs LAST, restoring what others might have removed.
add_filter('bulk_actions-woocommerce_page_wc-orders', function ($actions) {
// 1. Safety Check: Get current user
$u = wp_get_current_user();
if (!$u || empty($u->roles)) return $actions;
// 2. Define Target Roles (Adjust as needed)
$target_roles = array('shop_manager'); // You can add custom roles here
$is_target = (bool) array_intersect($target_roles, $u->roles);
// If not the target role, exit early
if (!$is_target) return $actions;
// 3. The Fail-Safe Condition
// If a plugin has cleared the actions, initialize as an empty array
if (!is_array($actions) || empty($actions)) {
$actions = array();
}
// 4. Restore Essentials
// We manually add the status change actions.
// Existence of keys here forces the Checkbox UI to render.
$actions['mark_processing'] = __('Change status to processing', 'woocommerce');
$actions['mark_completed'] = __('Change status to completed', 'woocommerce');
return $actions;
}, 9999);
How It Works
- Role Targeting: It strictly targets the roles you define (e.g.,
shop_manager). Administrators see the standard behavior. - Detection: It checks if
$actionsis empty or invalid. - Restoration: It forces the “Change status to processing” and “Change status to completed” actions back into the list.
The Result
- Checkboxes are guaranteed to appear for the target role.
- Admins are unaffected.
- No need to disable HPOS (High-Performance Order Storage) or downgrade plugins to fix missing UI elements.