How To Set the value of a custom transaction body field on the order

To use this method, pass in an object that contains the field ID, its type, and the value you want to set.
var cart = container.getComponent(‘Cart’);
var data = {
fieldId: “custbody_customerref”,
type: “string”,
value: “C123456”
}

cart.setTransactionBodyField(data).then(function() {
console.log(data.fieldId + ‘ was set to ‘ + data.value);
}).fail(function(error) {
console.log(‘setTransactionBodyField failed.’);
});

Leave a comment

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