Created
January 11, 2019 16:54
-
-
Save marcelo2605/f55406c5d04031c571684d3d48bc6b35 to your computer and use it in GitHub Desktop.
Register new order status on WooCommerce
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
/** | |
* Register new status | |
* | |
**/ | |
add_action('init', function() { | |
register_post_status('wc-producao', array( | |
'label' => 'Em produção', | |
'public' => true, | |
'exclude_from_search' => false, | |
'show_in_admin_all_list' => true, | |
'show_in_admin_status_list' => true, | |
'label_count' => _n_noop('Em produção <span class="count">(%s)</span>', 'Em produção <span class="count">(%s)</span>') | |
)); | |
}); | |
// Add to list of WC Order statuses | |
add_filter('wc_order_statuses', function($order_statuses) { | |
$new_order_statuses = array(); | |
foreach ($order_statuses as $key => $status) { | |
$new_order_statuses[$key] = $status; | |
if ('wc-processing' === $key) { | |
$new_order_statuses['wc-producao'] = 'Em produção'; | |
} | |
} | |
return $new_order_statuses; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment