Automattic\WooCommerce\Internal\Orders

OrderActionsRestController::get_template_id_enumprivateWC 1.0

Get the list of possible template ID values.

Note that this gets the IDs of all email templates. This does not mean all of these templates are available to send through the API endpoint.

Method of the class: OrderActionsRestController{}

No Hooks.

Returns

String[].

Usage

// private - for code of main (parent) class only
$result = $this->get_template_id_enum(): array;

OrderActionsRestController::get_template_id_enum() code WC 9.8.5

private function get_template_id_enum(): array {
	$enum = array();

	if ( is_array( WC()->mailer()->emails ) ) {
		$enum = array_map(
			function ( $template ) {
				if ( ! $template instanceof WC_Email || empty( $template->id ) ) {
					return null;
				}

				return $template->id;
			},
			WC()->mailer()->emails,
			array() // Strip off the associative array keys.
		);
	}

	return array_filter( $enum );
}