0

Accoring to this post https://developers.suitecommerce.com/try-out-the-loginregisterpage-userprofile-and-myaccountmenu-components, profile information is available throughout the site...

I need to display the user's firstname/lastname and email address in custom fields on the checkout in SCA. How do I access the data?

None of the followiing appear to work

'OrderWizard.Step.js defines 'Profile.Model' and includes ProfileModel in its functions... I've added the following in 'order_wizard_step.tpl'

{{profileModel.firstname}}
{{ProfileModel.firstname}}
{{Profile.firstname}}
{{profile.firstname}}

Expected output is for one of these to disaply the corresponding value Result is nothing at all

kitecom
  • 1
  • 1

1 Answers1

0

You're trying to access the profile model in your template, which is fine except that you would need to make sure that the profile model is passed to the template context using your view's getContext method. Looking at the code for 2019.1, this is not something that is in the context by default.

If you wanted to do this, then you would need to add the property to the view context, for example using the addToViewContextDefinition() method in the extensibility API.

However, for your specific query, this isn't a good overall solution. I would recommend:

  1. Follow my guide on creating a new checkout extension (https://developers.suitecommerce.com/coding-for-commerce-extensions-webinar-follow-up-extending-the-checkout-and-using-events)
  2. Add the UserProfile component to your extension's entry point file, passing it to your view
  3. Pass the first name and last name as properties in your view/template context object
  4. Auto-populate the field in the template by using standard HTML properties

I hope that helps.