Automattic\WooCommerce\Admin\Features\Blueprint\Exporters

ExportWCSettingsShipping::get_steps_for_classes_and_termsprotectedWC 1.0

Retrieve shipping classes and related terms.

Method of the class: ExportWCSettingsShipping{}

No Hooks.

Returns

Array. Steps for shipping classes and terms.

Usage

// protected - for code of main (parent) or child class
$result = $this->get_steps_for_classes_and_terms(): array;

ExportWCSettingsShipping::get_steps_for_classes_and_terms() code WC 11.0.1

protected function get_steps_for_classes_and_terms(): array {
	global $wpdb;

	$classes = $wpdb->get_results(
		"SELECT * FROM {$wpdb->prefix}term_taxonomy WHERE taxonomy = 'product_shipping_class'",
		ARRAY_A
	);

	$classes_steps = array_map(
		fn( $class_row ) => RunSql::from_table_row( $class_row, 'term_taxonomy' ),
		$classes
	);

	$terms = array_map(
		fn( $term ) => RunSql::from_table_row( $term, 'terms' ),
		$this->get_terms( $classes )
	);

	return array_merge( $classes_steps, $terms );
}