Click or drag to resize

EcommerceCartBeforeAddressValidationArgs Class

Provides information about order before address validation is executed.
Inheritance Hierarchy
SystemObject
  Dynamicweb.Extensibility.NotificationsNotificationArgs
    Dynamicweb.Ecommerce.NotificationsEcommerceCartBeforeAddressValidationArgs

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

The EcommerceCartBeforeAddressValidationArgs type exposes the following members.

Constructors
  NameDescription
Public methodEcommerceCartBeforeAddressValidationArgs
Initializes a new instance of the EcommerceCartBeforeAddressValidationArgs class
Top
Properties
  NameDescription
Public propertyAddress
The UserAddress being handled.
Public propertyAddressValidator
The AddressValidator being executed.
Public propertyCancel
Property indicating whether to cancel the execution of the address validation. Default value is false.
Public propertyOrder
The Order being handled.
Top
Remarks
The passed NotificationArgs is EcommerceCartBeforeAddressValidationArgs
Examples
C#
using Dynamicweb.Extensibility.Notifications;
using CartNotifications = Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart;

namespace Dynamicweb.Ecommerce.Examples.Notifications
{
    [Subscribe(CartNotifications.BeforeAddressValidation)]
    public class EcomCartOnBeforeAddressValidationObserver : NotificationSubscriber
    {
        public override void OnNotify(string notification, NotificationArgs args)
        {
            var beforeAddressValidationArgs = args as CartNotifications.BeforeAddressValidationArgs;
            // Skip address validation for countries other than US
            if (beforeAddressValidationArgs.Order.DeliveryCountryCode != "US")
            {
                beforeAddressValidationArgs.Cancel = true;
            }
        }
    }
}
See Also