Merci de votre inscription !
Voici le code en PHP dont vous avez besoin !
/*
* On ajoute un nouveau statut de post "en cours de livraison" dans WordPress
*/
function msk_create_being_delivered_status_in_wc() {
register_post_status(
‘wc-being-delivered’,
array(
‘label’ => __(‘A envoyer’, ‘uno’),
‘public’ => true,
‘exclude_from_search’ => false,
‘show_in_admin_all_list’ => true,
‘show_in_admin_status_list’ => true,
‘label_count’ => _n_noop(‘A envoyer <span class= »count »>(%s)</span>’, ‘A envoyer <span class= »count »>(%s)</span>’, ‘uno’)
)
);
}
add_action( ‘init’, ‘msk_create_being_delivered_status_in_wc’ );
/*
* On insère ce nouveau statut dans la liste des statuts utilisés par WooCommerce
*/
function msk_add_being_delivered_status_to_wc($order_statuses) {
$new_statuses_array = array();
foreach ($order_statuses as $key => $status) {
$new_statuses_array[$key] = $status;
if (‘wc-processing’ === $key) $new_statuses_array[‘wc-being-delivered’] = __(‘A envoyer’, ‘uno’);
}
return $new_statuses_array;
}
add_filter(‘wc_order_statuses’, ‘msk_add_being_delivered_status_to_wc’);