• Resolved sukvlm

    (@sukvlm)


    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)
  • Plugin Author tychesoftwares

    (@tychesoftwares)

    Hi @sukvlm,

    I apologize for the inconvenience caused to you.

    I’ll be checking this and will get back to you with an update.

    Thread Starter sukvlm

    (@sukvlm)

    Thank you.

    Plugin Author tychesoftwares

    (@tychesoftwares)

    Hi @sukvlm,

    Sorry for the delay in checking.

    I just checked and observed that the custom order statuses are being appeared in the “Bulk Action” list on Order page even if we have the code(shared by you) added to functions.php file.

    Could you confirm once again if there is something else causing this bug at your end?

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Bulk Action Custom order status is not showing’ is closed to new replies.