woocommerce_tax_based_on option

This commit is contained in:
Mike Jolley 2012-12-03 15:13:59 +00:00
parent 9faefb77c3
commit 9c74c02578
1 changed files with 26 additions and 6 deletions

View File

@ -324,17 +324,37 @@ class WC_Customer {
* @return void
*/
function get_taxable_address() {
if ( get_option( 'woocommerce_tax_shipping_address' ) == 'yes' ) {
$country = $this->get_shipping_country();
$state = $this->get_shipping_state();
$postcode = $this->get_shipping_postcode();
$city = $this->get_shipping_city();
} else {
$tax_based_on = get_option( 'woocommerce_tax_based_on' );
if ( $tax_based_on == 'base' ) {
$default = get_option( 'woocommerce_default_country' );
if ( strstr( $default, ':' ) ) {
list( $country, $state ) = explode( ':', $default );
} else {
$country = $default;
$state = '';
}
$postcode = '';
$city = '';
} elseif ( $tax_based_on == 'billing' ) {
$country = $this->get_country();
$state = $this->get_state();
$postcode = $this->get_postcode();
$city = $this->get_city();
} else {
$country = $this->get_shipping_country();
$state = $this->get_shipping_state();
$postcode = $this->get_shipping_postcode();
$city = $this->get_shipping_city();
}
return apply_filters( 'woocommerce_customer_taxable_address', array( $country, $state, $postcode, $city ) );
}