While working on a project recently, a client wanted to personalize the user experience on her site. Specifically, she wanted a welcome message for returning customers that greeted them by name. Alternatively, if a user was shopping as a guest or hadn’t yet logged in…it would be nice to ask them to log-in or register before shopping. This personal touch of course enhances the user experience and helps with conversions as well. Whether you want to admit it or not…you would be more likely to purchase something on a website that greets you by name.
So how can you achieve this welcome greeting for a visitor to your WooCommerce store? Realistically, it doesn’t have to be an e-commerce store, it could simply be any site looking to welcome a user. After Googling around a bit for a code snippet, I couldn’t find a thing. I couldn’t believe it. How was it possible that there wasn’t someone else who wanted this type of functionality. It couldn’t be that difficult. So I set out to create a shortcode that would offer this functionality. Why a shortcode? I figured that there might be several places througout the theme where this might come in handy. Initially it would reside in the sidebar on the shop pages and contact page but what if down the road it was going to be included in the header? Better to just create a shortcode so that it could be used where the code was dropped.It’s actually not that difficult and can be achieved with a code snippet added to the functions.php file.
So let’s get to it. It’s actually not that difficult and can be achieved with minimal code. Check out below to see how to add this functionality to your theme.
That’s all she wrote!