Automattic\WooCommerce\Blocks\BlockTypes\OrderConfirmation

ShippingAddress::render_content()protectedWC 1.0

This renders the content of the block within the wrapper.

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

Хуков нет.

Возвращает

Строку.

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

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->render_content( $order, $permission, $attributes, $content );
$order(\WC_Order) (обязательный)
Order object.
$permission(строка|false)
If the current user can view the order details or not.
По умолчанию: false
$attributes(массив)
Block attributes.
По умолчанию: []
$content(строка)
Original block content.
По умолчанию: ''

Код ShippingAddress::render_content() WC 9.6.2

protected function render_content( $order, $permission = false, $attributes = [], $content = '' ) {
	if ( ! $permission || ! $order->needs_shipping_address() || ! $order->has_shipping_address() ) {
		return $this->render_content_fallback();
	}

	$address = '<address>' . wp_kses_post( $order->get_formatted_shipping_address() ) . '</address>';
	$phone   = $order->get_shipping_phone() ? '<p class="woocommerce-customer-details--phone">' . esc_html( $order->get_shipping_phone() ) . '</p>' : '';

	$controller = Package::container()->get( CheckoutFields::class );
	$custom     = $this->render_additional_fields(
		$controller->get_order_additional_fields_with_values( $order, 'address', 'shipping', 'view' )
	);

	return $address . $phone . $custom;
}