Automattic\WooCommerce\Admin\Features\Blueprint\Exporters

ExportWCSettingsShipping::get_termsprotectedWC 1.0

Retrieve term data based on provided classes.

Method of the class: ExportWCSettingsShipping{}

No Hooks.

Returns

Array. Retrieved term data.

Usage

// protected - for code of main (parent) or child class
$result = $this->get_terms( $classes ): array;
$classes(array) (required)
List of classes with term IDs.

ExportWCSettingsShipping::get_terms() code WC 9.9.5

protected function get_terms( array $classes ): array {
	global $wpdb;

	$term_ids = array_map( fn( $term ) => (int) $term['term_id'], $classes );
	$term_ids = implode( ', ', $term_ids );

	return ! empty( $term_ids ) ? $wpdb->get_results(
		$wpdb->prepare(
			"SELECT * FROM {$wpdb->prefix}terms WHERE term_id IN (%s)",
			$term_ids
		),
		ARRAY_A
	) : array();
}