I am working with the Cart component in checkout. ...
# suitecommerce
k
I am working with the Cart component in checkout. The Cart component provides a method to set a transaction body field, but it doesn’t provide a method to fetch the current transaction body fields. How do you fetch the transaction body fields using the Extensibility API? Or do I need to access the LiveOrderModel in the checkout view?
e
@Keith Fetterman if you are creating an extension on the checkout, you are adding some logic to the checkout steps/modules/groups, so if you are using the
WizardModule.extend
to create your view, then you have access to the LiveOrder values using
this.wizard.model
. There you will find the transaction body fields.
k
@eminero thanks. That’s what I figured. The model property is not defined in the Extensibility API WizardModule class and I wanted to see if I could build an extension that only used the Extensibility API. Thanks for the help.
e
Oh but you are allowed to use the
WizardModule
I mean there is nothing wrong using it, in fact there is not equivalent yet in the Extensibility API, take a look at this article. https://developers.suitecommerce.com/add-a-new-module-to-the-checkout-with-the-extensibility-api.html If you are working something that would work on SCS, then you are good to go with my suggestion.
k
That’s what I am doing, i.e., extending the
WizardModule
. When I look at the Extensibility API for the
WizardModule
, including public and inherited members and methods, the “model” property is not defined. It’s also not mentioned in the article you referenced. To use the “model” property you need to have knowledge of the SCS core modules and data structures, which means you need access to SCA code. I assumed the Cart component fully replaced the LiveOrderModel in regards to fetching or setting cart data. The part that surprised me today is the ability to set transaction body field via the Cart component but there was no method to retrieve the current field values. I had implemented the Cart component in my extended
WizardModule
module to access the cart data. I will roll it back to using the
this.wizard.model
so it’s consistent. Thanks for the help.
e
I see, that makes sense! Yeah, I'm not sure if that was intentional but you are right, the Cart Component is missing that ability.