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.

Why I Figured This Out

I developed a workflow that would allow a client to take deposits on custom orders. It involves programatically setting the order status to deposit_paid but the customer needs to still be able to pay the rest of the balance. By adding deposit_paid to the list of valid order statuses for payment, the customer can come back and pay the rest of the invoice when the order is ready to ship.

Jack Harner

Jack Harner

Web Designer, Photographer, Graphic Designer, Marketer, Entrepreneur.


Pretty Much A Jack Of All Trades

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.