Display a custom message to logged-in users in WooCommerce

This code snippet displays a custom message to logged-in users on the WooCommerce shop page. The message says "Welcome back! Thank you for being a loyal customer."

PHP

add_action( 'woocommerce_before_shop_loop', 'custom_msg_logged_in_users' );

function custom_msg_logged_in_users() {
if ( is_user_logged_in() ) {
   echo '<p>Welcome back! Thank you for being a loyal customer.</p>';
}
}

Snippet Feedback

Did this snippet work for you? Do you have any questions about this snippet? Leave some feedback below.
SHARED BY

3 Views

Tags

Language

Did it work?

Save Snippet

Embed Snippet

To embed this snippet on your site, copy this html code and paste into your webpage. Learn more
By embedding snippets on your site, you are agreeing to our terms and conditions.

Embed Snippet

To embed this snippet on your site, copy this html code and paste into your webpage. Learn more
By embedding snippets on your site, you are agreeing to our terms and conditions.

Embed Snippet

To embed this snippet on your site, copy this html code and paste into your webpage. Learn more
By embedding snippets on your site, you are agreeing to our terms and conditions.