WordPress at Your Fingertips
function is not described

Automattic\WooCommerce\Admin

CategoryLookup::on_edit() public WC 1.0

When a product category gets edited, see if we need to sync the table.

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

No Hooks.

Return

null. Nothing.

Usage

$CategoryLookup = new CategoryLookup();
$CategoryLookup->on_edit( $category_id );
$category_id(int) (required)
Term ID being edited.

Code of CategoryLookup::on_edit() WC 5.8.0

public function on_edit( $category_id ) {
	global $wpdb;

	if ( ! isset( $this->edited_product_cats[ $category_id ] ) ) {
		return;
	}

	$category_object = get_term( $category_id, 'product_cat' );
	$prev_parent     = $this->edited_product_cats[ $category_id ];
	$new_parent      = $category_object->parent;

	// No edits - no need to modify relationships.
	if ( $prev_parent === $new_parent ) {
		return;
	}

	$this->delete( $category_id, $prev_parent );
	$this->update( $category_id );
}