WC_Customer::get_taxable_address()publicWC 1.0

Get taxable address.

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

Возвращает

Массив.

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

$WC_Customer = new WC_Customer();
$WC_Customer->get_taxable_address();

Код WC_Customer::get_taxable_address() WC 8.7.0

public function get_taxable_address() {
	$tax_based_on = get_option( 'woocommerce_tax_based_on' );

	// Check shipping method at this point to see if we need special handling.
	if ( true === apply_filters( 'woocommerce_apply_base_tax_for_local_pickup', true ) && count( array_intersect( wc_get_chosen_shipping_method_ids(), apply_filters( 'woocommerce_local_pickup_methods', array( 'legacy_local_pickup', 'local_pickup' ) ) ) ) > 0 ) {
		$tax_based_on = 'base';
	}

	if ( 'base' === $tax_based_on ) {
		$country  = WC()->countries->get_base_country();
		$state    = WC()->countries->get_base_state();
		$postcode = WC()->countries->get_base_postcode();
		$city     = WC()->countries->get_base_city();
	} elseif ( 'billing' === $tax_based_on ) {
		$country  = $this->get_billing_country();
		$state    = $this->get_billing_state();
		$postcode = $this->get_billing_postcode();
		$city     = $this->get_billing_city();
	} else {
		$country  = $this->get_shipping_country();
		$state    = $this->get_shipping_state();
		$postcode = $this->get_shipping_postcode();
		$city     = $this->get_shipping_city();
	}

	/**
	 * Filters the taxable address for a given customer.
	 *
	 * @since 3.0.0
	 *
	 * @param array  $taxable_address An array of country, state, postcode, and city for the customer's taxable address.
	 * @param object $customer        The customer object for which the taxable address is being requested.
	 *
	 * @return array The filtered taxable address for the customer.
	 */
	return apply_filters( 'woocommerce_customer_taxable_address', array( $country, $state, $postcode, $city ), $this );
}