1

I want to add google map in Magento 2 checkout page.

Added API url and key to phtml using below code

<referenceContainer name="after.body.start">
            <block class="Test\Vendor\Block\Map"
                   name="google.map"
                   as="googleapi"
                   template="Test_CVendor::map.phtml" />
        </referenceContainer>

And added my script to map.phtml.

<script async defer
        src="https://maps.googleapis.com/maps/api/js?libraries=places<?php echo $this->getApiKey(); ?>">
</script>

I have added custom component in checkout_index_index.xml from that component I have set template and define div over their like

Now I want to render google map to this div.

Can any one please guide me for which binding I need to use and how to render map over this div.

Your Answer

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

Browse other questions tagged or ask your own question.