WordPress at Your Fingertips
function is not described

WC_Settings_Tax::save_tax_classes() public WC 1.0

Saves tax classes defined in the textarea to the tax class table instead of an option.

{} It's a method of the class: WC_Settings_Tax{}

No Hooks.

Return

null. Nothing.

Usage

$WC_Settings_Tax = new WC_Settings_Tax();
$WC_Settings_Tax->save_tax_classes( $raw_tax_classes );
$raw_tax_classes(string) (required)
Posted value.

Code of WC_Settings_Tax::save_tax_classes() WC 5.9.0

public function save_tax_classes( $raw_tax_classes ) {
	$tax_classes          = array_filter( array_map( 'trim', explode( "\n", $raw_tax_classes ) ) );
	$existing_tax_classes = WC_Tax::get_tax_classes();
	$removed              = array_diff( $existing_tax_classes, $tax_classes );
	$added                = array_diff( $tax_classes, $existing_tax_classes );

	foreach ( $removed as $name ) {
		WC_Tax::delete_tax_class_by( 'name', $name );
	}

	foreach ( $added as $name ) {
		$tax_class = WC_Tax::create_tax_class( $name );

		// Display any error that could be triggered while creating tax classes.
		if ( is_wp_error( $tax_class ) ) {
			WC_Admin_Settings::add_error(
				sprintf(
					/* translators: 1: tax class name 2: error message */
					esc_html__( 'Additional tax class "%1$s" couldn\'t be saved. %2$s.', 'woocommerce' ),
					esc_html( $name ),
					$tax_class->get_error_message()
				)
			);
		}
	}

	return null;
}