Automattic\WooCommerce\Blocks\BlockTypes\OrderConfirmation
Totals::render_order_details_table_item_purchase_note
Render an item purchase note.
Method of the class: Totals{}
Hooks from the method
Returns
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() Totals::render order details table item purchase note code WC 10.3.5
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>' : '';
}