IEcommerceCheckoutPageChanging event

This event occurs when the user navigates from one step to another in the Checkout widget. During these steps you can perform things like:

  • Work with custom fields that are added to the CartOrder object.
    For example, you can use custom fields in order to collect additional information (e.g. Gift Message) during the checkout process. These values are stored as custom fields of the CartOrder and Order objects. To provide an input for these fields, you modify the templates of the checkout widget. The only place where you can get the input for the fields and store it in the database is the EcommerceCheckoutPageChanging event. For a detailed example of this scenario, read the For developers: Add custom fields to the Checkout widget.
  • Perform additional validation checks using hooks into their ERP or Inventory system.
  • Pull or push data to their CRM.

The argument is of type Telerik.Sitefinity.Modules.Ecommerce.Events. IEcommerceCheckoutPageChangingEvent. It has the following specific members:

  • Container
    Represents an instance of the GenericContainer for the current step. It contains instances of the controls in the template for the current step.
  • CurrentStepIndex
    Represents the number of the step. You can use this value to determine the current step. The order of the steps is as follows:
    • Shipping information – 0
    • Shipping options – 1
    • Payment – 2
    • Preview – 3

      NOTE:
      When there is no product that requires shipping, the Shipping options step is hidden and the indexes are as follows:
      • Shipping and billing information – 0
      • Payment – 1
      • Preview – 2
  • ShoppingCartId
    Represents the ID of the shopping cart that is currently used by the customer. Using this ID you can get instance of the cart and perform changes to the information in it.
  • UserId
    Represents the ID of the user that is currently performing the checkout. Based on this ID you can get instance of the customer or the user and gather additional information about them.

To hook up to this event, you must perform the following:

  • Handle the Initialized event of the Bootstrapper.
    For more information, read For developers: Ecommerce events.
  • Subscribe to the event.
    In the handler for the Bootstrapped event of the Bootstrapper, subscribe to the event using the Subscribe static method of EventHub class. As generic argument pass IEcommerceCheckoutPageChangingEvent, and as the handler argument pass the method to handle the event.

Use the following code sample:

Increase your Sitefinity skills by signing up for our free trainings. Get Sitefinity-certified at Progress Education Community to boost your credentials.

Get started with Integration Hub | Sitefinity Cloud | Sitefinity SaaS

This free lesson teaches administrators, marketers, and other business professionals how to use the Integration hub service to create automated workflows between Sitefinity and other business systems.

Web Security for Sitefinity Administrators

This free lesson teaches administrators the basics about protecting yor Sitefinity instance and its sites from external threats. Configure HTTPS, SSL, allow lists for trusted sites, and cookie security, among others.

Foundations of Sitefinity ASP.NET Core Development

The free on-demand video course teaches developers how to use Sitefinity .NET Core and leverage its decoupled architecture and new way of coding against the platform.

Was this article helpful?