2

How to add text between countries and phone number magento2 checkout shipping address.

1 Answer 1

5

You can easily add text by override LayoutProcessor method.

File: di.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <type name="Magento\Checkout\Block\Checkout\LayoutProcessor">
        <plugin name="rewrite-checkout-fields" type="Vendor\Module\Plugin\LayoutProcessorPlugin" sortOrder="10"/>
    </type>
</config>

File path:Vendor\Module\Plugin

File:LayoutProcessorPlugin.php

<?php
namespace Vendor\Module\Plugin;

class LayoutProcessorPlugin
{
    /**
     * @param \Magento\Checkout\Block\Checkout\LayoutProcessor $subject
     * @param array $jsLayout
     * @return array
     */

    public function afterProcess(
        \Magento\Checkout\Block\Checkout\LayoutProcessor $subject,
        array  $jsLayout
    ) {
        $jsLayout['components']['checkout']['children']['steps']['children']['shipping-step']
            ['children']['shippingAddress']['children']['shipping-address-fieldset']['children']['country_id']['notice'] = __('Your text here'); 

        return $jsLayout;
    }
}

NOTE: Code Tested

enter image description here

1
  • 2
    correct answer +1 Sep 25, 2019 at 7:22

Not the answer you're looking for? Browse other questions tagged or ask your own question.