I would like to add a function that fires when the customer selects a product variant. Just as the price appears (after choosing variants).
It is a simple function (from functions.php) that reads additional information about productions from the database. However, I do not know if there is such a hook?
To add a text on selecting a variation you can use the following:
add_filter('woocommerce_available_variation', 'variation_custom_text', 10, 3 );
function variation_custom_text( $variation_data, $product, $variation ) {
// Here your custom text
$custom_text = __("This is my custom text…", "woocommerce");
$variation_data['availability_html'] .= '<p>' . $custom_text . '</p>';
return $variation_data;
}
Code goes in function.php file of the active child theme (or active theme). Tested and works.