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 10.6.2

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 ) => new RunSql( Util::array_to_insert_sql( $class_row, $wpdb->prefix . 'term_taxonomy', 'replace into' ) ),
		$classes
	);

	$terms = array_map(
		fn( $term ) => new RunSql( Util::array_to_insert_sql( $term, $wpdb->prefix . 'terms', 'replace into' ) ),
		$this->get_terms( $classes )
	);

	return array_merge( $classes_steps, $terms );
}