WordPress at Your Fingertips
function is not described

WC_Abstract_Order::get_tax_location() protected WC 3.2.0

Get tax location for this order.

{} It's a method of the class: WC_Abstract_Order{}

Hooks from the method

Return

Array.

Usage

// protected - for code of main (parent) or child class
$result = $this->get_tax_location( $args );
$args(array)
array Override the location.
Default: array()

Changelog

Since 3.2.0 Introduced.

Code of WC_Abstract_Order::get_tax_location() WC 5.8.0

protected function get_tax_location( $args = array() ) {
	$tax_based_on = get_option( 'woocommerce_tax_based_on' );

	if ( 'shipping' === $tax_based_on && ! $this->get_shipping_country() ) {
		$tax_based_on = 'billing';
	}

	$args = wp_parse_args(
		$args,
		array(
			'country'  => 'billing' === $tax_based_on ? $this->get_billing_country() : $this->get_shipping_country(),
			'state'    => 'billing' === $tax_based_on ? $this->get_billing_state() : $this->get_shipping_state(),
			'postcode' => 'billing' === $tax_based_on ? $this->get_billing_postcode() : $this->get_shipping_postcode(),
			'city'     => 'billing' === $tax_based_on ? $this->get_billing_city() : $this->get_shipping_city(),
		)
	);

	// Default to base.
	if ( 'base' === $tax_based_on || empty( $args['country'] ) ) {
		$args['country']  = WC()->countries->get_base_country();
		$args['state']    = WC()->countries->get_base_state();
		$args['postcode'] = WC()->countries->get_base_postcode();
		$args['city']     = WC()->countries->get_base_city();
	}

	return apply_filters( 'woocommerce_order_get_tax_location', $args, $this );
}