2

I created a new order status in Woocommerce, but I need the status will be paid.

My code that creates a new status is:

add_filter( 'woocommerce_register_shop_order_post_statuses', 'bbloomer_register_custom_order_status' );

function bbloomer_register_custom_order_status( $order_statuses ){

    // Status must start with "wc-"
    $order_statuses['wc-custom-status'] = array(                                            
    'label'                     => _x( 'Aprobada', 'Order status', 'woocommerce' ),
    'public'                    => false,                                            
    'exclude_from_search'       => false,                                            
    'show_in_admin_all_list'    => true,                                         
    'show_in_admin_status_list' => true,                                         
    'label_count'               => _n_noop( 'Custom Status <span class="count">(%s)</span>', 'Aprobadas <span class="count">(%s)</span>', 'woocommerce' ),                                       
    );      

    return $order_statuses;
}

But I can´t put a paid status…

I found this code (in this thread):

if( $booking->get_status() != 'paid' )
    $booking->update_status( 'paid', 'order_note' );

But I don´t know how integrate it. I need that a new status will be paid.

LoicTheAztec
  • 229,944
  • 23
  • 356
  • 399
fakasmile1
  • 97
  • 2
  • 13
  • Please try to reword your question as it's not really understandable (you can use [Google translate](https://translate.google.com/)) … The code `$booking->get_status() != 'paid'` is related to Woocommerce Bookings. Are you using Woocommerce bookings plugin? Please try to better explain things in your question, adding the missing details, as it's unclear for now. – LoicTheAztec Mar 16 '19 at 18:15
  • @LoicTheAztec thankyou, i´m not using woocomemerce bookings.would be a new state of woocommerce orders, with the characteristic that is within "paid". – fakasmile1 Mar 18 '19 at 11:58
  • You mean "status" may be as Order status (instead of "state")… There is a lot of answers to create a new custom order status in StackOverFlow much more complete than the provided one in your code: Take a look to [this answers made by me](https://stackoverflow.com/search?q=user%3A3730754+wc_order_statuses) or [this other ones](https://stackoverflow.com/search?q=wc_order_statuses) – LoicTheAztec Mar 18 '19 at 12:27

0 Answers0