how to show product custom taxonomies in woocommerce rest api

I eventually found a way using filters. I didn’t know there were filters for REST API responses…
Here is my solution :

add_filter( 'woocommerce_rest_prepare_product', 'custom_products_api_data', 90, 2 );
function custom_products_api_data( $response, $post ) {

    // retrieve a custom field and add it to API response
    $response->data['custom_taxonomy1'] = wp_get_post_terms( $post->ID, 'custom_taxonomy1', [] );
    $response->data['custom_taxonomy2'] = wp_get_post_terms( $post->ID, 'custom_taxonomy2', [] );

    return $response;

}

`
Source : https://francescocarlucci.com/woocommerce-api-add-custom-data-default-endpoints/