WC_Admin_Taxonomies::save_category_fields()publicWC 1.0

Save category fields

Method of the class: WC_Admin_Taxonomies{}

No Hooks.

Return

null. Nothing (null).

Usage

$WC_Admin_Taxonomies = new WC_Admin_Taxonomies();
$WC_Admin_Taxonomies->save_category_fields( $term_id, $tt_id, $taxonomy );
$term_id(mixed) (required)
Term ID being saved.
$tt_id(mixed)
Term taxonomy ID.
Default: ''
$taxonomy(string)
Taxonomy slug.
Default: ''

WC_Admin_Taxonomies::save_category_fields() code WC 9.4.2

public function save_category_fields( $term_id, $tt_id = '', $taxonomy = '' ) {
	if ( isset( $_POST['display_type'] ) && 'product_cat' === $taxonomy ) { // WPCS: CSRF ok, input var ok.
		update_term_meta( $term_id, 'display_type', esc_attr( $_POST['display_type'] ) ); // WPCS: CSRF ok, sanitization ok, input var ok.
	}
	if ( isset( $_POST['product_cat_thumbnail_id'] ) && 'product_cat' === $taxonomy ) { // WPCS: CSRF ok, input var ok.
		update_term_meta( $term_id, 'thumbnail_id', absint( $_POST['product_cat_thumbnail_id'] ) ); // WPCS: CSRF ok, input var ok.
	}
}