WC_Order_Refund::get_tax_location │ protected │ WC 11.3.0

Get the tax location of the parent order, since refunds have no address of their own. In case of no parent order taxable location, return the store base location.

Method of the class: WC_Order_Refund{}

No Hooks.

Returns

array.

Usage

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

Changelog

Since 11.3.0 Introduced.

WC_Order_Refund::get_tax_location() code WC 11.3.0

protected function get_tax_location( $args = array() ) {
	$parent_order = wc_get_order( $this->get_parent_id() );

	if ( $parent_order ) {
		return $parent_order->get_taxable_location( $args );
	}

	return wp_parse_args(
		$args,
		array(
			'country'  => WC()->countries->get_base_country(),
			'state'    => WC()->countries->get_base_state(),
			'postcode' => WC()->countries->get_base_postcode(),
			'city'     => WC()->countries->get_base_city(),
		)
	);
}