Skip to content
Advertisement

Setting custom order statuses as paid in WooCommerce

I have a custom status that I need to set as ‘paid’, in the same sense that the core statuses Processing and Complete are ‘paid’ statuses.

I need to do this because WC is synced to accounting software, and the sync is unable to generate a sales receipt for an unpaid order. It works fine when using Complete or Processing statuses, but not for my custom status.

I’m using Setting custom order statuses as valid for payment answer code.

I can confirm, however, that this does not set the order as paid. I almost assumed it couldn’t be done, but I see that Woocommerce Order Status Manager has the option to set the status as Paid (see below screenshot).

enter image description here

Hoping somebody can help me!

Advertisement

Answer

What @Martin said. You have this available:

apply_filters( 'woocommerce_order_is_paid_statuses', array( 'processing', 'completed' ) );

So, you can add to it with add_filter():

add_filter( 'woocommerce_order_is_paid_statuses', 'bbloomer_paid_is_paid_status' );

function bbloomer_paid_is_paid_status( $statuses ) {
   $statuses[] = 'paid';
   return $statuses;
}
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement