We want to add a custom field to the marketingData in orderForm. This field should appear in order details page(Admin) inside SALES AND MARKETING section. I tried below code but looks like we are not allowed to add a custom field which will appear in admin.
Adding customer class to order details page
function customData() {
vtexjs.checkout.getOrderForm().then(function(orderForm) {
let clientProfileData = orderForm.clientProfileData;
let customerClass = clientProfileData.customerClass;
let marketingdata;
let marketingData = orderForm.marketingData;
if(marketingData === null) {
marketingdata = {}
} else {
marketingdata = marketingData;
}
marketingdata.customerClassField = customerClass;
return vtexjs.checkout.sendAttachment("marketingData", marketingdata);
});
}
$(window).on('load', customData);
$(window).on('haschange', customData);