Make WooCommerce Custom Order Status Payable

Do you have a custom WooCommerce Order Status that you want to be able to take payments on? Look no further than the woocommerce_valid_order_statuses_for_payment filter. I spent an ungodly amount of time looking for this filter today. I knew what I needed, but I didn't know what it was called. I knew there was a wc_order_is_editable filter that you could add statuses too, so I figured there had to be one to be able to require payment on a custom order status.

Make WooCommerce Custom Order Status Payable

After many trials and tribulations, I present to you my findings:

function filter_woocommerce_valid_order_statuses_for_payment($array, $instance)
        $my_order_status = array('cancelled', '<custom_order_status>');
        return array_merge($array, $my_order_status);

    // add the filter
    add_filter('woocommerce_valid_order_statuses_for_payment', 'filter_woocommerce_valid_order_statuses_for_payment', 10, 2);

This beautifully simple piece of code will add the list of order statuses to the statuses that can access the checkout or Form Pay.

Leave a Reply

Your email address will not be published. Required fields are marked *

Keep Up With Harner Designs!

Get updates about New Projects, Products, Discounts, and Giveaways from Harner Designs!

By submitting your email, you agree to our Privacy Policy and give us consent to send you marketing and promotional emails. You can unsubscribe at any time.