Click or drag to resize

EcommerceCartBeforeOrderValidationArgs Class

Provides information before order validation is executed.
Inheritance Hierarchy
SystemObject
  Dynamicweb.Extensibility.NotificationsNotificationArgs
    Dynamicweb.Ecommerce.NotificationsEcommerceCartBeforeOrderValidationArgs

Namespace:  Dynamicweb.Ecommerce.Notifications
Assembly:  Dynamicweb.Ecommerce (in Dynamicweb.Ecommerce.dll) Version: 1.10.0
Syntax
public class BeforeOrderValidationArgs : NotificationArgs

The EcommerceCartBeforeOrderValidationArgs type exposes the following members.

Constructors
  NameDescription
Public methodEcommerceCartBeforeOrderValidationArgs
Initializes a new instance of the EcommerceCartBeforeOrderValidationArgs class
Top
Properties
  NameDescription
Public propertyCancel
Property indicating whether to cancel the execution of the order validation. Default value is false.
Public propertyOrder
The Order being validated.
Public propertyValidationErrors
A list of validation errors. Add or remove errors from the collection to modify the result of the validation.
Top
Examples
C#
namespace Dynamicweb.Ecommerce.Examples.Notifications.CartV2
{
    [Dynamicweb.Extensibility.Notifications.Subscribe(Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.BeforeOrderValidation)]
    public class EcomCartBeforeOrderValidationObserver : Dynamicweb.Extensibility.Notifications.NotificationSubscriber
    {
        public override void OnNotify(string notification, Dynamicweb.Extensibility.Notifications.NotificationArgs args)
        {
            var beforeValidationArgs = args as Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.BeforeOrderValidationArgs;

            // Skip validation for countries other than US
            if (beforeValidationArgs.Order.DeliveryCountryCode != "US")
            {
                beforeValidationArgs.Cancel = true;
            }
        }
    }
}
See Also