Modifying Options Of Item Condition Select Box

Type: Filter
Name: td_condition_selection_fields
Location: wp-trade/inc/TD_Filters.php

Adding New Options

1
2
3
4
5
6
7
8
9
10
11
12
13
14
function add_extra_condition_selection_fields( $condition ) {
   
    // Add Conditions
    $extra_condition = array(
        'refurbished'   => __('Refurbished', 'wp-trade'),
        'reserved'      => __('Reserved', 'wp-trade')
    );
 
    // combine the two arrays
    $condition = array_merge( $extra_condition, $condition );
   
    return $condition;
}
add_filter('td_condition_selection_fields', 'add_extra_condition_selection_fields');

Removing Options

1
2
3
4
5
6
7
8
9
10
11
12
function remove_conditions_selection_fields( $condition ) {
       
    // Remove Conditions
    unset(
        $condition['new'],
        $condition['used']
    );
   
    return $condition;
   
}
add_filter('td_condition_selection_fields', 'remove_conditions_selection_fields');

Updating Options

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
function edited_conditions_selection_fields( $condition ) {
       
    // Update Conditions
    $edited_condition = array(
        'new'       => __('Never Used', 'wp-trade'),
        'used'      => __('Used', 'wp-trade')
    );
   
    // combine the two arrays
    $condition = array_merge( $condition, $edited_condition );
   
    return $condition;
   
}
add_filter('td_condition_selection_fields', 'edited_conditions_selection_fields');


Do you need help with a project? or have a new project in mind that you need help with?

Contact Me