I want to set the limitation for count of address list on the checkout page.
can we restrict it or not, if yes then How to do that.
Thanks in advance.
I want to set the limitation for count of address list on the checkout page.
can we restrict it or not, if yes then How to do that.
Thanks in advance.
Copy the file in your local theme from
vendor\magento\module-checkout\view\frontend\web\js\view\shipping-address\list.js Modify the function ,
/** @inheritdoc */ initChildren: function () {
if(addressList().length > 0){ this.createRendererComponent(addressList()[0],this); /* It always set the first shipping address. Change the logic as per your requirement */ } else{ _.each(addressList(), this.createRendererComponent, this); } return this; }, To hide New Address button,
Copy the html template from
vendor\magento\module-checkout\view\frontend\web\template\shipping.html To the local theme and comment the below code
<if args="!isFormInline"> <button type="button" class="action action-show-popup" click="showFormPopUp" visible="!isNewAddressAdded()"> <span translate="'New Address'" /> </button> <div id="opc-new-shipping-address" visible="isFormPopUpVisible()" render="shippingFormTemplate" /> </if>