0

In one page checkout i need to find html file for the address block. Please can someone help me with that. I want to put first name and last name together in a div.

1
  • 1
    vendor/magento/module-checkout/view/frontend/web/template/shipping-address/ from here you can see html code Oct 18, 2019 at 8:51

1 Answer 1

2

You can override from

vendor/magento/module-checkout/view/frontend/web/template/shipping-address/address-renderer/default.html

to

app/design/frontend/Vendor/Module/Magento_Checkout/web/template/shipping-address/address-renderer/default.html

<!--
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */
-->
<div class="shipping-address-item" data-bind="css: isSelected() ? 'selected-item' : 'not-selected-item'">
    <!-- ko text: address().prefix --><!-- /ko --> 

    <div>
        <!-- ko text: address().firstname --><!-- /ko -->
        <!-- ko text: address().middlename --><!-- /ko -->
        <!-- ko text: address().lastname --><!-- /ko -->
    </div> 

    <!-- ko text: address().suffix --><!-- /ko --><br/>
    <!-- ko text: _.values(address().street).join(", ") --><!-- /ko --><br/>
    <!-- ko text: address().city --><!-- /ko -->, <span data-bind="html: address().region"></span> <!-- ko text: address().postcode --><!-- /ko --><br/>
    <!-- ko text: getCountryName(address().countryId) --><!-- /ko --><br/>
    <!-- ko if: (address().telephone) -->
    <a data-bind="text: address().telephone, attr: {'href': 'tel:' + address().telephone}"></a>
    <!-- /ko --><br/>
    <!-- ko foreach: { data: address().customAttributes, as: 'element' } -->
        <!-- ko foreach: { data: Object.keys(element), as: 'attribute' } -->
            <!-- ko if: (typeof element[attribute] === "object") -->
                <!-- ko text: element[attribute].value --><!-- /ko -->
            <!-- /ko -->
            <!-- ko if: (typeof element[attribute] === "string") -->
                <!-- ko text: element[attribute] --><!-- /ko -->
            <!-- /ko --><br/>
        <!-- /ko -->
    <!-- /ko -->
    <!-- ko if: (address().isEditable()) -->
    <button type="button"
            class="action edit-address-link"
            data-bind="click: editAddress, visible: address().isEditable()">
        <span data-bind="i18n: 'Edit'"></span>
    </button>
    <!-- /ko -->
    <button type="button" data-bind="click: selectAddress" class="action action-select-shipping-item">
        <span data-bind="i18n: 'Ship Here'"></span>
    </button>
</div>
6
  • Can you tell how can i put first name and last name together in a div
    – surbhi agr
    Oct 18, 2019 at 8:54
  • Please check with updated answer...I have added firstname, middlename and lastname in a single div. Oct 18, 2019 at 8:57
  • Okay thanks for updating. actually i have to make it collapsible ie on clicking the name, it should get collapsed and expanded. ANy advice for that?
    – surbhi agr
    Oct 18, 2019 at 8:59
  • I can't get you. Please explain more in question. Oct 18, 2019 at 9:03
  • Edited the question
    – surbhi agr
    Oct 18, 2019 at 9:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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