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.

Метод класса: WC_Order_Refund{}

Хуков нет.

Возвращает

array.

Использование

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->get_tax_location( $args );
$args(массив)
Override the location.
По умолчанию: array()

Список изменений

С версии 11.3.0 Введена.

Код WC_Order_Refund::get_tax_location() 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(),
		)
	);
}