Woocommerce get_term_by() in transition_post_status hook doesn’t works

I don’t know why Woocommerce wasn’t load at this time but I solve my issue adding this code :

if (! taxonomy_exists(  'product_cat' ) && class_exists('WC_Post_Types') ) {
    // Dans le cas ou la taxonomies n'est pas register
    WC_Post_Types::register_taxonomies();
}