Magento 2: Personalization for the shopper

In this story, magento development services vendor will explain the significance of personalization for the shopper. Read this article thoroughly to find how personalized experience makes a lot of difference for shoppers.

Shopping is a personal experience. When people visit your site very rarely are they looking for the same thing, especially if you are a large retailer with a multitude of products? Shoppers deserve a personalized experience.


Read More : Speed Up Content Deployment within Magento 2

This experience will start with a call to action to entice the customer to log in. Make it a banner in your existing slider, make it a modal, or just make a larger button in the header. Once the customer has logged in you can pull their name and use it to drive their experience.

Try something simple, like the shoppers first name. You can access their name with the use of this code:

<?php $customerSession = $objectManager->get('Magento\Customer\Model\Session'); if($customerSession->isLoggedIn()) { echo $customerSession->getCustomer()->getFirstname(); } ?>

Generally this would be placed in the header as a way to let people know they are logged in. However this just pulls in the name of the customer. There needs to be a little more functionality. You can easily make it so that customers will first see the phrase, “Sign in and Register.” Then when they are logged in they will see their name and the option to “log out.”

Incorporate this with your other code. You can see where your existing code is already. Just paste this over it:

<ul class="nav navbar-nav login"> <?php if ($customerSession->isLoggedIn()): ?> <li class="logged-in-welcome"> <span>Welcome,</span> <?php $customerSession = $objectManager->get('Magento\Customer\Model\Session'); if($customerSession->isLoggedIn()) { echo $customerSession->getCustomer()->getFirstname(); // get Full Name } ?> </li> <li id="customer-action-one" class="dropdown"> <a href="<?php echo $url.'customer/account/logout/' ?>">Sign Out</a> </li> <?php else: ?> <li id="customer-action-two" class="dropdown"> <a href="<?php echo $url.'customer/account/login/' ?>">Sign In</a> </li> <li id="customer-action-three"> <a href="<?php echo $url.'customer/account/create/' ?>">Register</a> </li> <?php endif; ?> </ul>

The code above creates the common logged in and logged out feature that you will see on most sites. Where else can you use this code to personalize your customer’s experience? Try adding the snippets below to customize your customer’s experience even more.

$customer->getPrefix(); $customer->getName(); // Full Name $customer->getFirstname(); // First Name $customer->getMiddlename(); // Middle Name $customer->getLastname(); // Last Name $customer->getSuffix();

Customization will set you apart from your competitors. Customers like to hear their name.

If you break apart the code above you can do just about anything for your logged in customers. Specifically this block of code:

<?php $customerSession = $objectManager->get('Magento\Customer\Model\Session'); if($customerSession->isLoggedIn()) { //If the customer is logged-in, do this. } ?>

You can contact magento development services providers to avail personalized experience for your shoppers. For further queries and doubts, you can write comments here.

The above code is very powerful. It says, “If the customer is logged in, do this.” There are endless possibilities here. What about loading special CSS? What about introducing special sales or coupons? Feel free to experiment on a local sandbox.