Remove add option for shipping address and edit option of default billing address

In SCA website the shipping address can be added from my-account and checkout section.
Hide the add option for shipping address from my-account and checkout section. User’s should not be able to add the address.

In Billing address,
Remove the option to edit address in the default billing address.
There should be option to edit and remove for non default billing address.

_.extend(AddressDetailsView.prototype, {
getContext: _.wrap(AddressDetailsView.prototype.getContext, function (fn) {
var originalRet=fn.apply(this, _.toArray(arguments).slice(1));
try {
var currentUrl=window.location.href;
currentUrl=currentUrl.split("#");
currentUrl=currentUrl[1];
currentUrl=currentUrl.split("?");
var manage=currentUrl[0];
var addressLength=originalRet.model.collection.length;
var defaultBill=originalRet.isDefaultBillingAddress;
if (defaultBill==true) {
originalRet.showActionButtons=false;
}
if (manage!="billing") {
var hideEdit=true;
originalRet.showActionButtons=false;
}
//code for removing the 'Edit' and 'Remove' options.
if (!!hideEdit) {
setTimeout(function () {
$('[data-action="edit-address"]').addClass('hidden').prop('disabled', true).val('');
$('[data-action="remove"]').addClass('hidden').prop('disabled', true).val('');
$('.overview-shipping-card-button-edit').addClass('hidden').prop('disabled', true).val('');
if (addressLength >= 1) {
$('#order-wizard-address-module-placeholder .order-wizard-address-module-address-container .order-wizard-address-row a.address-details-new-address').hide();
$('.address-list .address-list-default-addresses a.address-details-new-address').hide();
}

}, 100);
}
} catch (e) {
console.log("Error occured in hideEdit", e)
}
return originalRet;
})
});
} catch (e) {
console.log("Error occured in RemoveshipAddressEdit", e)
}
}
};

Leave a comment

Your email address will not be published. Required fields are marked *