Missing setTransactionBodyField in SuiteCommerce Cart Component 

in , December 6th, 2024
a close up of a computer keyboard on a table

Is the setTransactionBodyField method missing in your SuiteCommerce Cart component instance?

Check Your SuiteCommerce Version

If so, verify the version of your SuiteCommerce (or SuiteCommerce Advanced) site. If it is older than 2021.1, you should not expect this method in the Cart component.

This is because the setTransactionBodyField method was introduced to the Cart component in the 2021.1 version of the SuiteCommerce release.

Snapshot of NetSuite's Release Notes of SuiteCommerce v2021.1.0

Code Sample: Set Custom Transaction Body Field on Cart

One option to get around this issue is to try the following code snippet to set a custom transaction body field on the cart.

if(_.isFunction(cart.setTransactionBodyField)){
	cart.setTransactionBodyField({
		'fieldId': 'custbody_old_rx_number'
	,	'type': 'select'
	,	'value': String(rxnumber['internalid']).toString()
	});
}
else{
	var liveOrderModel = LiveOrderModel.getInstance();


	liveOrderModel.set('options',
		_.extend(liveOrderModel.get('options'), {
			'custbody_old_rx_number': String(rxnumber['internalid']).toString()
		})
	);


	liveOrderModel.save();
}

Author: Sohan Kumar Dash


Got stuck on a step in this article?

We like to update our blogs and articles to make sure they help resolve any troubleshooting difficulties you are having. Sometimes, there is a related feature to enable or a field to fill out that we miss during the instructions. If this article didn't resolve the issue, please use the chat and let us know so that we can update this article!

Oracle NetSuite Alliance Partner & Commerce Partner

If you have questions about how our team can support your business as you implement NetSuite or SuiteCommerce, feel free to contact us anytime. Anchor Group is a certified Oracle NetSuite Alliance Partner and Commerce Partner equipped to handle all kinds of NetSuite and SuiteCommerce projects, large or small!

 
 

Want to keep learning?

Our team of NetSuite and ecommerce professionals has written articles on a wide variety of topics, from step-by-step tutorials, to solution recommendations, available support services, and more!

Your cart