Automattic\WooCommerce\Internal\Orders

OrderActionsRestController::get_default_preferred_template_idsprivateWC 1.0

Get the default preferred template IDs for auto-selection based on order status.

Method of the class: OrderActionsRestController{}

No Hooks.

Returns

String[].

Usage

// private - for code of main (parent) class only
$result = $this->get_default_preferred_template_ids( $order ): array;
$order(WC_Order) (required)
The order.

OrderActionsRestController::get_default_preferred_template_ids() code WC 10.8.1

private function get_default_preferred_template_ids( WC_Order $order ): array {
	$status                 = $order->get_status( 'edit' );
	$preferred_template_ids = array();

	// Status-specific template.
	if ( isset( self::STATUS_TEMPLATE_MAP[ $status ] ) ) {
		$preferred_template_ids[] = self::STATUS_TEMPLATE_MAP[ $status ]['id'];
	}

	// Generic fallback.
	$preferred_template_ids[] = 'customer_invoice';

	return $preferred_template_ids;
}