woogists
3/9/2018 - 4:19 PM

[Returns and Warranty Requests] Add custom statuses

[Returns and Warranty Requests] Add custom statuses

function warranty_add_custom_statuses() {
if (! function_exists('warranty_get_statuses')) return;

// Statuses to add
$statuses = array('Custom Status 1', 'Custom Status 2');

foreach ( $statuses as $status ) {
  $term = get_term_by( 'name', $status, 'shop_warranty_status' );

  if (! $term ) {
    wp_insert_term( $status, 'shop_warranty_status' );
  }
}
add_action( 'init', 'warranty_add_custom_statuses', 30 );