WC_Abstract_Order::get_shipping_to_display()publicWC 1.0

Gets shipping (formatted).

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

Возвращает

Строку.

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

$WC_Abstract_Order = new WC_Abstract_Order();
$WC_Abstract_Order->get_shipping_to_display( $tax_display );
$tax_display(строка)
Excl or incl tax display mode.
По умолчанию: ''

Код WC_Abstract_Order::get_shipping_to_display() WC 8.7.0

public function get_shipping_to_display( $tax_display = '' ) {
	$tax_display = $tax_display ? $tax_display : get_option( 'woocommerce_tax_display_cart' );

	if ( 0 < abs( (float) $this->get_shipping_total() ) ) {

		if ( 'excl' === $tax_display ) {

			// Show shipping excluding tax.
			$shipping = wc_price( $this->get_shipping_total(), array( 'currency' => $this->get_currency() ) );

			if ( (float) $this->get_shipping_tax() > 0 && $this->get_prices_include_tax() ) {
				$shipping .= apply_filters( 'woocommerce_order_shipping_to_display_tax_label', '&nbsp;<small class="tax_label">' . WC()->countries->ex_tax_or_vat() . '</small>', $this, $tax_display );
			}
		} else {

			// Show shipping including tax.
			$shipping = wc_price( (float) $this->get_shipping_total() + (float) $this->get_shipping_tax(), array( 'currency' => $this->get_currency() ) );

			if ( (float) $this->get_shipping_tax() > 0 && ! $this->get_prices_include_tax() ) {
				$shipping .= apply_filters( 'woocommerce_order_shipping_to_display_tax_label', '&nbsp;<small class="tax_label">' . WC()->countries->inc_tax_or_vat() . '</small>', $this, $tax_display );
			}
		}

		/* translators: %s: method */
		$shipping .= apply_filters( 'woocommerce_order_shipping_to_display_shipped_via', '&nbsp;<small class="shipped_via">' . sprintf( __( 'via %s', 'woocommerce' ), $this->get_shipping_method() ) . '</small>', $this );

	} elseif ( $this->get_shipping_method() ) {
		$shipping = $this->get_shipping_method();
	} else {
		$shipping = __( 'Free!', 'woocommerce' );
	}

	return apply_filters( 'woocommerce_order_shipping_to_display', $shipping, $this, $tax_display );
}