Hello Magento Friends,

Welcome to the “How To” Magento 2 Blog series. Today’s topic to learn about is How to Add Customer Name in CMS Page/Block in Magento 2. In case you haven’t checked our previous article, Magento 2: How to Get Order Details with Custom Extension Attributes using REST API.

Introduction:

74% of people feel frustrated if the website content is not personalized and stops them from shopping. Hence, customization helps in boosting the user experience of your store and enhance sales. With Magento 2, you can customize everything from the look of the website to product categories and their features.

With Magento 2, you can customize CMS Page or Block. Magento merchants can add customer names to provide a personalized experience to customers. Let’s start learning How to Add Customer Name in CMS Page/Block in Magento 2.

Steps to Add Customer Name in CMS Page/Block in Magento 2:

Step 1: Create one block file on your custom extension at the below path:

app\code\Vendor\Extension\Block\Customerinfo.php

Step 2: Now create a phtml file in the below path 

app\code\Vendor\Extension\view\frontend\templates\mycustomfile.phtml

Now call this phtml file into your CMS Block or CMS Page.

Conclusion:

This way you can Add Customer Name in CMS Page/Block in Magento 2. For any hardships with the execution of the above code, write to me in the comment part below. Do share the article amongst your Magento colleagues. Stay tuned for more such Magento solutions.

Happy Coding!

[Total: 9   Average: 4.1/5]