/** * Output the settings */ public function output() { global $current_section; if ($current_section) { $base_country = wc_get_base_location(); $not_available_countries = array(); $regions = get_option('wc_price_based_country_regions', array()); foreach ($regions as $key => $value) { foreach ($value['countries'] as $code) { if ($current_section !== $key) { $not_available_countries[] = $code; } } } if ($current_section == 'new_group') { $this->section_settings($not_available_countries); } else { if (isset($regions[$current_section])) { $this->section_settings($not_available_countries, $regions[$current_section]); } } } else { parent::output(); } }
/** * Output the settings */ public function output() { global $current_section; if ($current_section) { $country_groups = get_option('_oga_tfls_countries_groups'); $not_available_countries = array(); if ($country_groups) { foreach ($country_groups as $key => $value) { foreach ($value['countries'] as $code) { if ($current_section !== $key) { $not_available_countries[] = $code; } } } } if ($current_section == 'new_group') { $this->section_settings($not_available_countries); } else { if (isset($country_groups[$current_section])) { $this->section_settings($not_available_countries, $country_groups[$current_section]); } } } else { parent::output(); } wp_enqueue_script('wc-tfls-admin', plugin_dir_url(TFLS_FILE) . 'assets/js/tfls-admin.js', array('woocommerce_settings'), WC_VERSION, true); }