To Restrict a return process we are checking the customer segment and adding the condition for the return button on the website and if the condition is satisfied then the button will be hide.
code:
_.extend(OrderHistorySummaryView.prototype, {
getContext: _.wrap(OrderHistorySummaryView.prototype.getContext, function (fn) {
try {
let context = fn.apply(this, _.toArray(arguments).slice(0));
let profile = profileModel.getInstance();
var customerData = profile._previousAttributes.customfields;
let customerSegment = _.find(customerData, segement=> segement.name === "custentity_hidden_customersegment")
if (customerSegment) {
let segmentValue = customerSegment.value ? (JSON.parse(customerSegment?.value))[0].value : "";
if (segmentValue === 'Wholesale-Blvd') {
$(document).ready(function () {
$('.order-history-summary-button-request-return').css('display', 'none');
})
}
}
return context;
} catch (error) {
console.error('Error @ GetContext', error);
}
})
})