1

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?

2 Answers 2

2

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.

0

I did the same but it wasn't working then after I did R&D again and I seen your solution and it exactly same as I did. But still it's not working in my Magento 2.4.4.

I ran the all commands as well.

Thanks.

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.