Updated: As I dont have and I don't use your commercial plugin and as your question is not so clear… There is 2 possibilities:
1) You would like to add the short description (from the parent variable product) for the product variations that are displayed (with your plugin) on woocommerce archives pages (like shop …), just like the other products.
This should do the trick (untested with no errors):
add_action( 'woocommerce_after_shop_loop_item_title', 'add_short_description', 9 );
function add_short_description() {
global $post;
// 1. Product variation
if ($post->post_type = 'product_variation'){
$post_parent_id = $post->post_parent; // Get the parent variable product ID
$post_parent = get_post( $post_parent_id ); // Get the parent variable WP_Post object
$text = $post_parent->post_excerpt; // Get the short description from the parent variable product
}
// 2. Other cases (simple, variable …)
else {
$text = $post->post_excerpt;
}
$maxchar = 75; // Maximum number of characters
$text = preg_replace ('~\[[^\]]+\]~', '', $text ); // Remove shortcodes
// Remove all html symbols
//$text = strip_tags( $text);
// Crop
if ( mb_strlen( $text ) > $maxchar ){
$text = mb_substr( $text, 0, $maxchar );
$text = preg_replace('@(.*)\s[^\s]*$@s', '\\1 ...', $text );
}
echo "<span class='catalog-short-desc'>$text</span>";
}
2) You would like to add the description of the product variations that are displayed (with your plugin) on woocommerce archives pages (like shop …), just like the other products… For Product variation short description doesn't exist (it's empty)…
This should do the trick (untested with no errors):
// For Woocommerce versions 3+ only
add_action( 'woocommerce_after_shop_loop_item_title', 'add_short_description', 9 );
function add_short_description() {
global $post, $product;
// 1. Product variation
if ( $product->is_type('product_variation') ){
// Get the product variation description
// short description doesn't exist for product variations
$text = $product->get_description();
// If the product variation description is empty, we get the parent short description
if( empty( $text ) ){
$parent_id = $product->get_parent_id(); // The parent variable product ID
$parent_product = wc_get_product( $parent_id ); // The parent WC_Product object
$text = $parent_product->get_short_description();
}
}
// 2. Other cases (simple, variable …)
else {
$text = $product->get_short_description();
}
$maxchar = 75; // Maximum number of characters
$text = preg_replace ('~\[[^\]]+\]~', '', $text ); // Remove shortcodes
// Remove all html symbols
//$text = strip_tags( $text);
// Crop
if ( mb_strlen( $text ) > $maxchar ){
$text = mb_substr( $text, 0, $maxchar );
$text = preg_replace('@(.*)\s[^\s]*$@s', '\\1 ...', $text );
}
echo "<span class='catalog-short-desc'>$text</span>";
}
Code goes in function.php file of your active child theme (or theme) or also in any plugin file.