I have ratings and add to cart button next to each other. But I need to place add to cart button in the parent of ratings div class. In order to align the button to the right using flex css. Because I have
I did the following with no result
echo '<div class ="mywrapper">'. woocommerce_template_loop_add_to_cart() . '<div class="star-rating"><span style="width:'.( ( $average / 5 ) * 100 ) . '%"><strong itemprop="ratingValue" class="rating">'.$average.'</strong> '.__( 'out of 5', 'woocommerce' );
echo '</div></div>';
echo '<div class ="mywrapper">'. <? php echo woocommerce_template_loop_add_to_cart() ?> . '<div class="star-rating"><span style="width:'.( ( $average / 5 ) * 100 ) . '%"><strong itemprop="ratingValue" class="rating">'.$average.'</strong> '.__( 'out of 5', 'woocommerce' );
echo '</div></div>';
The add to cart always is outside class "mywrapper"
While I need to have the following
Is there any way to achieve this? thank you


