$counties_array, 'rate' => $rate, 'shipping' => $shipping, 'class' => $class ); endif; endfor; update_option($value['id'], $tax_rates); elseif (isset($value['type']) && $value['type']=='multi_select_countries') : // Get countries array if (isset($_POST[$value['id']])) $selected_countries = $_POST[$value['id']]; else $selected_countries = array(); update_option($value['id'], $selected_countries); elseif ( isset($value['id']) && ( $value['id'] == 'woocommerce_price_thousand_sep' || $value['id'] == 'woocommerce_price_decimal_sep' ) ): // price separators get a special treatment as they should allow a spaces (don't trim) if( isset( $_POST[ $value['id'] ] ) ) { update_option($value['id'], $_POST[$value['id']] ); } else { delete_option($value['id']); } elseif (isset($value['type']) && $value['type']=='checkbox') : if(isset($value['id']) && isset($_POST[$value['id']])) { update_option($value['id'], 'yes'); } else { update_option($value['id'], 'no'); } elseif (isset($value['type']) && $value['type']=='image_width') : if(isset($value['id']) && isset($_POST[$value['id'].'_width'])) { update_option($value['id'].'_width', woocommerce_clean($_POST[$value['id'].'_width'])); update_option($value['id'].'_height', woocommerce_clean($_POST[$value['id'].'_height'])); } else { update_option($value['id'].'_width', $value['std']); update_option($value['id'].'_height', $value['std']); } else : if(isset($value['id']) && isset($_POST[$value['id']])) { update_option($value['id'], woocommerce_clean($_POST[$value['id']])); } else { delete_option($value['id']); } endif; } return true; } /** * Admin fields * * Loops though the woocommerce options array and outputs each field. */ function woocommerce_admin_fields($options) { global $woocommerce; foreach ($options as $value) : switch($value['type']) : case 'title': if (isset($value['name']) && $value['name']) echo '