Automattic\WooCommerce\Blocks\BlockTypes\OrderConfirmation
BillingAddress::render_content
This renders the content of the block within the wrapper.
Method of the class: BillingAddress{}
No Hooks.
Returns
String.
Usage
// protected - for code of main (parent) or child class $result = $this->render_content( $order, $permission, $attributes, $content );
- $order(WC_Order) (required)
- Order object.
- $permission(string|false)
- If the current user can view the order details or not.
Default: false - $attributes(array)
- Block attributes.
Default: [] - $content(string)
- Original block content.
Default: ''
BillingAddress::render_content() BillingAddress::render content code WC 10.3.6
protected function render_content( $order, $permission = false, $attributes = [], $content = '' ) {
if ( ! $permission || ! $order->has_billing_address() ) {
return '';
}
$address = '<address>' . wp_kses_post( $order->get_formatted_billing_address() ) . '</address>';
$phone = $order->get_billing_phone() ? '<p class="woocommerce-customer-details--phone">' . esc_html( $order->get_billing_phone() ) . '</p>' : '';
$controller = Package::container()->get( CheckoutFields::class );
$custom = $this->render_additional_fields(
$controller->get_order_additional_fields_with_values( $order, 'address', 'billing', 'view' )
);
return $address . $phone . $custom;
}