I want to hide this new address button based on customer group. I want to use conditions for hiding that button. If anyone knows please let me know.
Check this still loadind and console.
Magento Stack Exchange is a question and answer site for users of the Magento e-Commerce platform. It only takes a minute to sign up.
Sign up to join this communityTry the following way:
app/code/SR/MagentoCommunity/view/frontend/requirejs-config.js
var config = {
config: {
mixins: {
'Magento_Checkout/js/view/shipping': {
'SR_MagentoCommunity/js/mixin/shipping-mixin': true
}
}
}
};
app/code/SR/MagentoCommunity/view/frontend/web/js/mixin/shipping-mixin.js
define(
[
'jquery',
'underscore',
'ko'
], function (
$,
_,
ko
) {
'use strict';
return function (target) {
return target.extend({
/**
* @inheritDoc
*/
initialize: function () {
this._super();
var self = this;
var quoteData = window.checkoutConfig.quoteData;
var customerGroupId = parseInt(quoteData.customer_group_id);
if (!this.isFormInline) {
_.each([3,4], function (value) {
if (value == customerGroupId) {
self.isNewAddressAdded(true);
}
} );
}
return this;
}
});
}
}
);