Skip to content

Instantly share code, notes, and snippets.

@hedqvist
Last active June 29, 2020 08:26
Show Gist options
  • Select an option

  • Save hedqvist/d1b2d7bec07cc8cf635c9c6bec3968ec to your computer and use it in GitHub Desktop.

Select an option

Save hedqvist/d1b2d7bec07cc8cf635c9c6bec3968ec to your computer and use it in GitHub Desktop.
WooCommerce - Add Custom Status
<?php
/**
* @snippet WooCommerce - Add custom status
* @author Redlight Media AB / Christopher Hedqvist
* @compatible WooCommerce 4.1.1
*/
add_filter('wc_order_statuses', 'add_custom_order_status' );
public function add_custom_order_status( $order_statuses ){
$order_statuses['wc-fetched'] = __('Fetched');
return $order_statuses;
}
add_action('init', 'register_custom_order_status');
function register_custom_order_status(){
register_post_status( 'wc-fetched', array(
'label' => __('Fetched'),
'public' => true,
'exclude_from_search' => false,
'show_in_admin_all_list' => true,
'show_in_admin_status_list' => true,
'label_count' => _n_noop( __('Fetched') . '<span class="count">(%s)</span>', __('Fetched') . '<span class="count">(%s)</span>' )
) );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment