Created
September 12, 2014 13:49
-
-
Save claudiosanches/e68e891d593c4c989d9d to your computer and use it in GitHub Desktop.
WooCommerce 2.2 - Register new order statuses.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// My new order statuses. | |
function register_my_new_order_statuses() { | |
register_post_status( 'wc-status-name', array( | |
'label' => _x( 'Status Name', 'Order status', 'textdomain' ), | |
'public' => true, | |
'exclude_from_search' => false, | |
'show_in_admin_all_list' => true, | |
'show_in_admin_status_list' => true, | |
'label_count' => _n_noop( 'Status name <span class="count">(%s)</span>', 'Status names <span class="count">(%s)</span>', 'textdomain' ) | |
) ); | |
} | |
add_action( 'init', 'register_my_new_order_statuses' ); | |
// Register in wc_order_statuses. | |
function my_new_wc_order_statuses( $order_statuses ) { | |
$order_statuses['wc-status-name'] = _x( 'Status Name', 'Order status', 'textdomain' ); | |
return $order_statuses; | |
} | |
add_filter( 'wc_order_statuses', 'my_new_wc_order_statuses' ); |
How can I also send the email with the new order status ? Just like the woocommerce sends an email to the customer when change the order status to "Completed".
I also have a similar issue like @jwad93. I want to send emails as soon as the status of product gets changed.
But in Woocommerce>Settings>Email only predefined options are present. For every status we hava a file separately stored in woocommerce>templates>emails.
So do I need to create a new file for every custom order status??
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I just want to change the name of the existing orders. Didn't find how to do that anywhere.
I used this code and it changed the names in the main list, but in the actions dropdown and the filter in orders list dons't change.
Any thoughts? Thanks very much!
function wc_get_order_statuses() {
$order_statuses = array(
'wc-pending' => _x( '1 - Em orçamento', 'Order status', 'woocommerce' ),
'wc-processing' => _x( '2 - Pedido em atendimento', 'Order status', 'woocommerce' ),
'wc-on-hold' => _x( '3 - Pedido enviado', 'Order status', 'woocommerce' ),
'wc-completed' => _x( '4 - Pedido realizado', 'Order status', 'woocommerce' ),
'wc-cancelled' => _x( 'Cancelado', 'Order status', 'woocommerce' ),
'wc-refunded' => _x( 'Reembolso ao cliente', 'Order status', 'woocommerce' ),
'wc-failed' => _x( 'Falhou', 'Order status', 'woocommerce' ),
);
return apply_filters( 'wc_order_statuses', $order_statuses );
}