Automattic\WooCommerce\Admin\Features\Fulfillments

FulfillmentsRenderer::render_fulfillment_customer_detailspublicWC 1.0

Render the fulfillment customer details in the order details page.

Method of the class: FulfillmentsRenderer{}

No Hooks.

Returns

null. Nothing (null).

Usage

$FulfillmentsRenderer = new FulfillmentsRenderer();
$FulfillmentsRenderer->render_fulfillment_customer_details( $order );
$order(WC_Order) (required)
The order object.

FulfillmentsRenderer::render_fulfillment_customer_details() code WC 10.9.1

<?php
public function render_fulfillment_customer_details( WC_Order $order ) {
	$fulfillments = $this->maybe_read_fulfillments( $order );

	if ( ! empty( $fulfillments ) ) {
		?>
<section class="woocommerce-order-details">
<table class="woocommerce-table woocommerce-table--order-details shop_table order_details">
	<thead>
		<?php
		foreach ( $fulfillments as $index => $fulfillment ) {
			if ( ! $fulfillment->get_is_fulfilled() ) {
				continue;
			}
			?>
		<tr>
			<th class="woocommerce-table__shipment-info shipment-info" style="font-weight: normal;">
			<?php
			// Use the UTC fulfilled date when available; fall back to date_updated.
			$shipment_date_utc = $fulfillment->get_date_fulfilled()
				?? $fulfillment->get_date_updated();
			// Append ' UTC' so strtotime treats the stored value as UTC, then render in the site's timezone.
			$shipment_timestamp  = $shipment_date_utc ? strtotime( $shipment_date_utc . ' UTC' ) : false;
			$shipment_date_local = false !== $shipment_timestamp ? wp_date( 'F j, Y', $shipment_timestamp ) : '';
			printf(
				/* translators: %1$s is the shipment index, %2$s is the shipment date */
				wp_kses( __( '<b>Shipment %1$s</b> was shipped on <b>%2$s</b>', 'woocommerce' ), 'b' ),
				intval( $index ) + 1,
				esc_html( (string) $shipment_date_local )
			);
			?>
			</th>
			<th class="woocommerce-table__shipment-tracking shipment-tracking" style="font-weight: normal;">
				<?php echo wp_kses( FulfillmentUtils::get_tracking_info_html( $fulfillment ), 'a' ); ?>
			</th>
		</tr>
			<?php
		}
		?>
	</thead>
</table>
</section>
		<?php
	}
}