Automattic\WooCommerce\Blocks\BlockTypes\OrderConfirmation

Totals::render_order_details_table_item_purchase_note()protectedWC 1.0

Render an item purchase note.

Method of the class: Totals{}

Return

String.

Usage

// protected - for code of main (parent) or child class
$result = $this->render_order_details_table_item_purchase_note( $order, $product );
$order(\WC_Order) (required)
Order object.
$product(\WC_Product|false) (required)
Product object if it exists.

Totals::render_order_details_table_item_purchase_note() code WC 8.9.0

protected function render_order_details_table_item_purchase_note( $order, $product ) {
	// phpcs:ignore WooCommerce.Commenting.CommentHooks.MissingHookComment
	$show_purchase_note = $order->has_status( apply_filters( 'woocommerce_purchase_note_order_statuses', array( 'completed', 'processing' ) ) );
	$purchase_note      = $product ? $product->get_purchase_note() : '';

	return $show_purchase_note && $purchase_note ? '<div class="product-purchase-note">' . wp_kses_post( $purchase_note ) . '</div>' : '';
}