add_action( 'woocommerce_single_product_summary', 'unavailable_product_display_message3', 20 );
function unavailable_product_display_message3() {
global $product;
if (!is_user_logged_in()){
if(! $product->is_purchasable() ){
?>
<a href="/my-account/" style="display: inline-block; background-color:#ffe194; padding: 10px;border-radius: 0px; margin-bottom: 10px; text-decoration: none; transition: background-color 0.3s ease-in-out;" onmouseover="this.style.backgroundColor='#ffc107';" onmouseout="this.style.backgroundColor='#ffe194';><p style="font-size: 12px; line-height: 1.5; margin: 0;">Please login to be able to purchase this product</p></a>
<?php
}
}
}