Automattic\WooCommerce\Blocks\BlockTypes\OrderConfirmation
AdditionalFieldsWrapper::render_content
This renders the content of the downloads wrapper.
Method of the class: AdditionalFieldsWrapper{}
No Hooks.
Returns
null. Nothing (null).
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:''
AdditionalFieldsWrapper::render_content() AdditionalFieldsWrapper::render content code WC 10.6.2
protected function render_content( $order, $permission = false, $attributes = [], $content = '' ) {
if ( ! $permission ) {
return '';
}
// Contact and additional fields are currently grouped in this section.
// If none of the additional fields for contact or order have values then the "Additional fields' section should
// not show in the order confirmation.
$additional_field_values = array_merge(
Package::container()->get( CheckoutFields::class )->get_order_additional_fields_with_values( $order, 'contact' ),
Package::container()->get( CheckoutFields::class )->get_order_additional_fields_with_values( $order, 'order' )
);
return empty( $additional_field_values ) ? '' : $content;
}