get_base_country() public method

Get the base country for the store.
public get_base_country ( ) : string
return string
コード例 #1
0
ファイル: wc-edostavka.php プロジェクト: kalbac/wc-edostavka
 public function admin_load_script($hook)
 {
     if ($hook !== 'woocommerce_page_wc-settings') {
         return;
     }
     wp_enqueue_script('edostavka-admin', plugins_url('/assets/js/admin.js', __FILE__), array('jquery'), self::VERSION, true);
     wp_localize_script('edostavka-admin', 'wc_params', array('default_country' => WC_Countries::get_base_country(), 'api_url' => $this->get_api_url()));
 }
コード例 #2
0
echo $zip;
?>
</label>
								<input type="text" name="billing_postcode" id="billing_postcode" value="<?php 
if (isset($customer)) {
    echo $customer['billing_postcode'];
}
?>
" tabindex="1" />
							</div>
							<div class="field_block">
								<?php 
global $woocommerce;
$countries_obj = new WC_Countries();
$countries = $countries_obj->__get('countries');
$default_country = $countries_obj->get_base_country();
$default_county_states = $countries_obj->get_states($default_country);
if (isset($customer['billing_state'])) {
    $default_state = $customer['billing_state'];
} else {
    $default_state = '';
}
woocommerce_form_field('billing_state', array('type' => 'select', 'class' => array('chzn-drop'), 'label' => $state, 'placeholder' => __('Select a State'), 'options' => $default_county_states, 'default' => $default_state));
?>
							</div>
							<div style="clear:both;"></div>
						</div>

						<div class="woocommerce" style="text-align:center;">
							<a class="checkout-button button alt wc-forward" href="#" onclick="jQuery('form.cart').submit();return(false);"><?php 
echo $addcart;
コード例 #3
0
 /**
  * init_form_fields function.
  *
  * @access public
  * @return void
  */
 public function init_form_fields()
 {
     global $woocommerce;
     $this->form_fields = array('enabled' => array('title' => __('Enable/Disable', 'wc_ups'), 'type' => 'checkbox', 'label' => __('Enable this shipping method', 'wc_ups'), 'default' => 'no'), 'title' => array('title' => __('Method Title', 'wc_ups'), 'type' => 'text', 'description' => __('This controls the title which the user sees during checkout.', 'wc_ups'), 'default' => __('UPS', 'wc_ups')), 'availability' => array('title' => __('Method Availability', 'wc_ups'), 'type' => 'select', 'default' => 'all', 'class' => 'availability', 'options' => array('all' => __('All Countries', 'wc_ups'), 'specific' => __('Specific Countries', 'wc_ups'))), 'countries' => array('title' => __('Specific Countries', 'wc_ups'), 'type' => 'multiselect', 'class' => 'chosen_select', 'css' => 'width: 450px;', 'default' => '', 'options' => $woocommerce->countries->get_allowed_countries()), 'api' => array('title' => __('API Settings', 'wc_ups'), 'type' => 'title', 'description' => __('You need to obtain UPS account credentials by registering on via their website.', 'wc_ups')), 'user_id' => array('title' => __('UPS User ID', 'wc_ups'), 'type' => 'text', 'description' => __('Obtained from UPS after getting an account.', 'wc_ups'), 'default' => ''), 'password' => array('title' => __('UPS Password', 'wc_ups'), 'type' => 'text', 'description' => __('Obtained from UPS after getting an account.', 'wc_ups'), 'default' => ''), 'access_key' => array('title' => __('UPS Access Key', 'wc_ups'), 'type' => 'text', 'description' => __('Obtained from UPS after getting an account.', 'wc_ups'), 'default' => ''), 'shipper_number' => array('title' => __('UPS Shipper Number', 'wc_ups'), 'type' => 'text', 'description' => __('Obtained from UPS after getting an account.', 'wc_ups'), 'default' => ''), 'origin_postcode' => array('title' => __('Origin Postcode', 'wc_ups'), 'type' => 'text', 'description' => __('Enter the zip/postcode for the <strong>sender</strong>.', 'wc_ups'), 'default' => ''), 'origin_country' => array('title' => __('Origin Country', 'wc_ups'), 'type' => 'select', 'class' => 'chosen_select', 'css' => 'width: 250px;', 'description' => __('Enter the country for the <strong>sender</strong>.', 'wc_ups'), 'default' => WC_Countries::get_base_country(), 'options' => $woocommerce->countries->get_allowed_countries()), 'negotiated' => array('title' => __('Negotiated Rates', 'wc_ups'), 'label' => __('Enable negotiated rates', 'wc_ups'), 'type' => 'checkbox', 'default' => 'no', 'description' => __('Enable this if this shipping account has negotiated rates available.', 'wc_ups')), 'debug' => array('title' => __('Debug Mode', 'wc_ups'), 'label' => __('Enable debug mode', 'wc_ups'), 'type' => 'checkbox', 'default' => 'yes', 'description' => __('Enable debug mode to show debugging information on your cart/checkout.', 'wc_ups')), 'pickup_destination' => array('title' => __('Pickup and Destination', 'wc_ups'), 'type' => 'title', 'description' => ''), 'pickup' => array('title' => __('Pickup', 'wc_ups'), 'type' => 'select', 'css' => 'width: 250px;', 'class' => 'chosen_select', 'default' => '01', 'options' => $this->pickup_code), 'residential' => array('title' => __('Residential', 'wc_ups'), 'label' => __('Enable residential address flag', 'wc_ups'), 'type' => 'checkbox', 'default' => 'no', 'description' => __('Enable this to indicate to UPS that the receiver is a residential address.', 'wc_ups')), 'services_packaging' => array('title' => __('Services and Packaging', 'wc_ups'), 'type' => 'title', 'description' => ''), 'services' => array('type' => 'services'), 'offer_rates' => array('title' => __('Offer Rates', 'wc_ups'), 'type' => 'select', 'description' => '', 'default' => 'all', 'options' => array('all' => __('Offer the customer all returned rates', 'wc_ups'), 'cheapest' => __('Offer the customer the cheapest rate only', 'wc_ups'))), 'fallback' => array('title' => __('Fallback', 'wc_ups'), 'type' => 'text', 'description' => __('If UPS returns no matching rates, offer this amount for shipping so that the user can still checkout. Leave blank to disable.', 'wc_ups'), 'default' => ''), 'packing_method' => array('title' => __('Parcel Packing Method', 'wc_ups'), 'type' => 'select', 'default' => '', 'class' => 'packing_method', 'options' => array('per_item' => __('Default: Pack items individually', 'wc_ups'), 'box_packing' => __('Recommended: Pack into boxes with weights and dimensions', 'wc_ups'))), 'ups_packaging' => array('title' => __('UPS Packaging', 'wc_ups'), 'type' => 'multiselect', 'description' => __('Select UPS standard packaging options to enable', 'wc_ups'), 'default' => array(), 'css' => 'width: 150px; height: 115px', 'class' => 'ups_packaging', 'options' => $this->packaging_select), 'boxes' => array('type' => 'box_packing'));
 }
コード例 #4
0
        <th scope="row" class="titledesc"> <label for="apg_sms_settings[campo_envio]">
            <?php 
_e('Shipping mobile field:', 'apg_sms');
?>
          </label>
          <span class="woocommerce-help-tip" data-tip="<?php 
_e('Select the shipping mobile field', 'apg_sms');
?>
"></span> </th>
        <td class="forminp forminp-number"><select id="apg_sms_settings[campo_envio]" name="apg_sms_settings[campo_envio]" class="wc-enhanced-select" tabindex="<?php 
echo $tab++;
?>
">
        <?php 
$pais = new WC_Countries();
$campos = $pais->get_address_fields($pais->get_base_country(), 'shipping_');
//Campos ordinarios
$campos_personalizados = apply_filters('woocommerce_checkout_fields', array());
if (isset($campos_personalizados['shipping'])) {
    $campos += $campos_personalizados['shipping'];
}
foreach ($campos as $valor => $campo) {
    $chequea = isset($configuracion['campo_envio']) && $configuracion['campo_envio'] == $valor ? ' selected="selected"' : '';
    if (isset($campo['label'])) {
        echo '<option value="' . $valor . '"' . $chequea . '>' . $campo['label'] . '</option>' . PHP_EOL;
    }
}
?>
        </select></td>
      </tr>
      <?php