Hi Selina,
You can try this PHP code.
add_action( 'woocommerce_after_shop_loop_item_title', 'display_size_attribute', 5 );
function display_size_attribute() {
global $product;
if ( $product->is_type('variable') ) {
$taxonomy = 'size';
echo '<span>' . $product->get_attribute($taxonomy) . '</span>';
}
}
Just change the $taxonomy = ‘size’; value to the slug of your size attribute.
ex: $taxonomy = ‘avail_size‘;
Here’s How to add PHP.
Let us know if it works for you.