HomeGuidesAPI Reference
Submit Documentation FeedbackJoin Developer CommunityOptimizely GitHubOptimizely NuGetLog In

Configure multiple order confirmation emails during checkout

This topic describes how to implement code to configure multiple order confirmation emails during checkout in Classic CMS.

You can use backend code to configure multiple order confirmation emails during checkout in Classic CMS and build your UI around this customization.

  1. Add the following to the addresses form in CheckoutAddressView/Standard.cshtml:
<input type="text" ng-model="vm.cart.additionalEmails" />
  1. Validate this field in the continueCheckout method of insite.checkout-address.controller.ts. The following code is an example:
if (this.cart.additionalEmails) {
    const emailRegex = /\w+([-+."]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/;
    if (!this.cart.additionalEmails.split(",").every(o => emailRegex.test(o))) {
        // show some error for additional emails input
        return;
    }
}
  1. Send additionalEmails field to the server by calling the following code in the updateSessionCompleted method of insite.checkout-address.controller.ts:
if (this.cart.additionalEmails) {
    this.cartService.updateCart(this.cart);
}

Did this page help you?