Table of Contents

Class Ecommerce.Cart.BeforeAddressValidationArgs

Namespace
Dynamicweb.Ecommerce.Notifications
Assembly
Dynamicweb.Ecommerce.dll

Provides information about order before address validation is executed.

public class Ecommerce.Cart.BeforeAddressValidationArgs : NotificationArgs
Inheritance
Ecommerce.Cart.BeforeAddressValidationArgs
Inherited Members

Examples

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;
            }
        }
    }
}

Remarks

The passed NotificationArgs is Ecommerce.Cart.BeforeAddressValidationArgs

Properties

Address

The UserAddress being handled.

public UserAddress Address { get; set; }

Property Value

UserAddress

AddressValidator

The AddressValidator being executed.

public AddressValidator AddressValidator { get; set; }

Property Value

AddressValidator

The address validator.

Cancel

Property indicating whether to cancel the execution of the address validation. Default value is false.

public bool Cancel { get; set; }

Property Value

bool

true if [cancel]; otherwise, false.

Order

The Order being handled.

public Order Order { get; set; }

Property Value

Order

The order.

See Also

To top