0

I have successfully shown the company name by overriding the Magento_Checkout/template/shipping-address/address-renderer/default.html file. And I tried to show the company name on the payment section, but not.

I tried the address().company code from Magento214/vendor/magento/module-offline-payments/view/frontend/web/template/payment/purchaseorder-form.html file but it's throwing the error.

Any suggestion on this?

1

Finally, solved my self by extending Magento_Checkout/template/billing-address/details.html.

requirejs-config.js file extend the core file like below.

var config = {
    map: {
        '*': {

            'Magento_Checkout/template/billing-address/details.html':
                'CompanyName_ModuleName/template/billing-address/default.html'

        }
    }
};

default.html file extend the core file like below.

<div class="billing-address-details" data-bind="if: isAddressDetailsVisible() && currentBillingAddress()">
    <!-- ko text: currentBillingAddress().prefix --><!-- /ko --> <!-- ko text: currentBillingAddress().firstname --><!-- /ko -->
    <!-- ko text: currentBillingAddress().lastname --><!-- /ko --> <!-- ko text: currentBillingAddress().suffix --><!-- /ko -->,<br/>
    <!-- ko text: currentBillingAddress().company --><!-- /ko -->,<br/>
    <!-- ko text: currentBillingAddress().street --><!-- /ko -->,<br/>
    <!-- ko text: currentBillingAddress().city --><!-- /ko -->, <!-- ko text: currentBillingAddress().region --><!-- /ko --> <!-- ko text: currentBillingAddress().postcode --><!-- /ko --><br/>
    <!-- ko text: getCountryName(currentBillingAddress().countryId) --><!-- /ko --><br/>
    <!-- ko text: currentBillingAddress().telephone --><!-- /ko --><br/>
    <!-- ko foreach: { data: currentBillingAddress().customAttributes, as: 'element' } -->
    <!-- ko foreach: { data: Object.keys(element), as: 'attribute' } -->
    <!-- ko if: element[attribute].value != null -->
    <!-- ko text: element[attribute].value --><!-- /ko -->
    <!-- /ko -->
    <!-- ko if: element[attribute].value == null -->
    <!-- ko text: element[attribute] --><!-- /ko -->
    <!-- /ko -->
    <!-- /ko -->
    <!-- /ko -->
    <button type="button"
            class="action action-edit-address"
            data-bind="visible: !isAddressSameAsShipping(), click: editAddress">
        <span data-bind="i18n: 'Edit'"></span>
    </button>
</div>

I have added the one line of code to above <!-- ko text: currentBillingAddress().company --><!-- /ko -->.

After that execute the commands => upgrade, static-content:deploy and run Magentoento website.

Feel free to ask if it's not working.

| improve this answer | |

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.