Bulk Action Custom order status is not showing
-
I am using a custom code to filter the order based on the payment method and I am using below code.
add_action('restrict_manage_posts', 'add_payment_method_filter'); function add_payment_method_filter() { global $typenow; if ($typenow === 'shop_order') { $payment_methods = array( 'cod' => 'Cash on Delivery', 'razorpay' => 'Razorpay', 'bacs' => 'Direct Bank Transfer', ); $current_payment_method = isset($_GET['payment_method']) ? $_GET['payment_method'] : ''; echo '<select name="payment_method">'; echo '<option value="">Select Payment Method</option>'; foreach ($payment_methods as $value => $label) { $selected = selected($current_payment_method, $value, false); echo '<option value="' . esc_attr($value) . '"' . $selected . '>' . esc_html($label) . '</option>'; } echo '</select>'; } } // Filter orders by payment method add_filter('parse_query', 'filter_orders_by_payment_method'); function filter_orders_by_payment_method($query) { global $pagenow; if (is_admin() && $pagenow === 'edit.php' && isset($_GET['payment_method']) && $_GET['payment_method'] !== '') { $query->query_vars['meta_key'] = '_payment_method'; $query->query_vars['meta_value'] = sanitize_text_field($_GET['payment_method']); } }
When you filter order through payment method my custom payment status is not showing in bulk action dropdown. Any idea what is the reason behind? Any help would be appreciated. Thanks in advance.
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Bulk Action Custom order status is not showing’ is closed to new replies.