With the growing use of the Internet, lots of store owner started switching online to reach a broader audience and gain more sales. And shoppers have grown more tech-savvy and with increased expectations. Nowadays, modern consumers don’t differentiate between offline store shopping versus online shopping. But doing online shopping has its own advantages compared to visiting and shop via an offline store. Also, the interesting fact is customer always remember unique shopping experience with easy flow to grab product. And Yeah, it always ends at Magento customization.
Recently, while working with one of the stores, the owner is willing to add some instructions or you can say comments to under checkout shipping address fields to avoid confusions and he was right at his place based on an issue he was facing. We thought it might help to other store owners like you, so we decided to write a short article on adding a custom comment in Magento 2 checkout shipping address field.
On a First step, you need to create a “di.xml” under this folder.
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<plugin name="rewrite-checkout-fields" type="Vendor\Extension\Model\Checkout\LayoutProcessorPlugin" sortOrder="10"/>
At Second step or last step, you need to create another file name “LayoutProcessorPlugin.php” at below path.
public function afterProcess(
['children']['shippingAddress']['children']['shipping-address-fieldset']['children']['firstname']['notice'] = __('You can not change your name once account is created.');
['children']['shippingAddress']['children']['shipping-address-fieldset']['children']['lastname']['notice'] = __(' You another Comment goes here');
You can use this code to add one or more comment to Magento 2 checkout shipping fields as per need.
Lastly, hit that falling stars if the code worked for you and don’t forget to comment down below if you are looking for any help regarding this code.