Class WC_Countries

WooCommerce countries

The WooCommerce countries class stores country/state data.

Package: WooCommerce\Classes
Category: Class
Author: WooThemes
Version: 1.6.4
Class: WC_Countries
Located at includes/class-wc-countries.php

Methods summary

public
# __construct( )

Constructor for the counties class - defines all countries and states.

Constructor for the counties class - defines all countries and states.

public string
# get_base_country( )

Get the base country for the store.

Get the base country for the store.

Returns

string
public string
# get_base_state( )

Get the base state for the store.

Get the base state for the store.

Returns

string
public string
# get_base_city( )

Get the base city for the store.

Get the base city for the store.

Returns

string
public string
# get_base_postcode( )

Get the base postcode for the store.

Get the base postcode for the store.

Returns

string
public array
# get_allowed_countries( )

Get the allowed countries for the store.

Get the allowed countries for the store.

Returns

array
public array
# get_shipping_countries( )

Get the countries you ship to.

Get the countries you ship to.

Returns

array
public array
# get_allowed_country_states( )

get_allowed_country_states function.

get_allowed_country_states function.

Returns

array
public array
# get_shipping_country_states( )

get_shipping_country_states function.

get_shipping_country_states function.

Returns

array
public array
# get_european_union_countries( )

Gets an array of countries in the EU.

Gets an array of countries in the EU.

Returns

array
public string
# shipping_to_prefix( )

Gets the correct string for shipping - ether 'to the' or 'to'

Gets the correct string for shipping - ether 'to the' or 'to'

Returns

string
public string
# estimated_for_prefix( )

Prefix certain countries with 'the'

Prefix certain countries with 'the'

Returns

string
public string
# tax_or_vat( )

Correctly name tax in some countries VAT on the frontend

Correctly name tax in some countries VAT on the frontend

Returns

string
public string
# inc_tax_or_vat( )

Include the Inc Tax label.

Include the Inc Tax label.

Returns

string
public string
# ex_tax_or_vat( )

Include the Ex Tax label.

Include the Ex Tax label.

Returns

string
public array
# get_states( string $cc )

Get the states for a country.

Get the states for a country.

Parameters

$cc
string
$cc country code

Returns

array
of states
public
# country_dropdown_options( string $selected_country = '', string $selected_state = '', boolean $escape = false )

Outputs the list of countries and states for use in dropdown boxes.

Outputs the list of countries and states for use in dropdown boxes.

Parameters

$selected_country
string
$selected_country (default: '')
$selected_state
string
$selected_state (default: '')
$escape
boolean
$escape (default: false)
public array
# get_address_formats( )

Get country address formats

Get country address formats

Returns

array
public string
# get_formatted_address( array $args = array() )

Get country address format

Get country address format

Parameters

$args
array
$args (default: array())

Returns

string
address
public array
# get_default_address_fields( )

Returns the fields we show by default. This can be filtered later on.

Returns the fields we show by default. This can be filtered later on.

Returns

array
public array
# get_country_locale_field_selectors( )

Get JS selectors for fields which are shown/hidden depending on the locale.

Get JS selectors for fields which are shown/hidden depending on the locale.

Returns

array
public array
# get_country_locale( )

Get country locale settings

Get country locale settings

Returns

array
public array
# get_address_fields( mixed $country, string $type = 'billing_' )

Apply locale and get address fields

Apply locale and get address fields

Parameters

$country
mixed
$country
$type
string
$type (default: 'billing_')

Returns

array

Magic methods summary

Properties summary

public array $countries
#

Array of countries

Array of countries

public array $states
#

Array of states

Array of states

public array $locale
#

Array of locales

Array of locales

public array $address_formats
#

Array of address formats for locales

Array of address formats for locales

WooCommerce API documentation generated by ApiGen 2.8.0