1

i am working on magento2 checkout page and i want to add tool tip after street address in shipping information section how can i do this please adivce.

0

Try the following way using plugin:

app/code/SR/MagentoCommunity/etc/frontend/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="sr_ModuleName_checkout_layout_processor"
                type="SR\MagentoCommunity\Plugin\Block\LayoutProcessor" sortOrder="1"/>
    </type>
</config>

app/code/SR/MagentoCommunity/Plugin/Block/LayoutProcessor.php

<?php
namespace SR\MagentoCommunity\Plugin\Block;

class LayoutProcessor
{
    /**
     * @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']['street']['children'][0]['config']['tooltip'] = [
            'description' => 'This is test tooltip for street'
        ];

        return $jsLayout;
    }
}
| improve this answer | |
  • Not working. I added your files, ran setup and static commands but not helpful. – Arsalan Ul Haq Apr 18 '19 at 6:14
  • Did you create new module using SR\MagentoCommunity? – Sohel Rana Apr 18 '19 at 6:30
  • yes I created a new module, but not added etc module.xml, should I add that also? – Arsalan Ul Haq Apr 18 '19 at 6:32
  • yes, please. Add module.xml and registration.php – Sohel Rana Apr 18 '19 at 6:34
  • just give me 10 mins, I'll add that and let you know – Arsalan Ul Haq Apr 18 '19 at 6:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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