1

I need to change Phone number label into Mobile number label which is present under Shipping address in Checkout Page.Please suggest me how to do it.Thanks in advance. enter image description here

5
  • follow this link
    – Hitesh
    Commented Oct 3, 2018 at 8:56
  • 1
    @Hit's I tried this.But it doesn't work.So only I asked here. Commented Oct 3, 2018 at 9:11
  • @ManashviBirla.The link you have provided does not include Phone number.Thats why I have asked separately. Commented Oct 3, 2018 at 9:12
  • 1
    @VishaliMariappan which Magento version are you used? as I just tried in Magento 2.2.6 and I translate successfully
    – Hitesh
    Commented Oct 3, 2018 at 9:12
  • @Hit's.I am using Magento2.2.4.Just one clarification.In code folder, I have Magento/module-checkout/i18n/en_US.csv.Is it module-checkout or Module_Checkout? Commented Oct 3, 2018 at 9:16

1 Answer 1

6

1.Create di.xml under app/code/Namespace/Module/etc.

<?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="Namespace\Module\Model\Checkout\LayoutProcessorPlugin" sortOrder="10"/>
    </type>
</config>

2.Create LayoutProcessorPlugin.php under app/code/Namespace/Module/Model/Checkout.

<?php
namespace Namespace\Module\Model\Checkout;

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']['telephone']['label'] = __('Mobile Number'); 

        return $jsLayout;
    }
}

See screen shot : enter image description here Please try the above code if useful then accept it will help others too.

0

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