'Custom product_cat data

I need to create product_cat with custom data (originalID), so I can identify categories (to add parent later).

I'm trien to create woocommerce categories like this:

$term = wp_insert_term( $name, 'product_cat', array() );    
$term = update_term_meta( $term->term_id, 'originalID', $internalID );

Categories are created successful but update_term_meta just returns false and I dont know why.

What am I missing?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source