Class Ecommerce.Cart.BeforeOrderValidationArgs
- Namespace
- Dynamicweb.Ecommerce.Notifications
- Assembly
- Dynamicweb.Ecommerce.dll
Provides information before order validation is executed.
public class Ecommerce.Cart.BeforeOrderValidationArgs : NotificationArgs
- Inheritance
-
Ecommerce.Cart.BeforeOrderValidationArgs
- Inherited Members
Examples
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;
}
}
}
}
Properties
Cancel
Property indicating whether to cancel the execution of the order validation.
Default value is
false
.public bool Cancel { get; set; }
Property Value
- bool
true
if [cancel]; otherwise,false
.
Order
The Order being validated.
public Order Order { get; set; }
Property Value
- Order
- The order.
ValidationErrors
A list of validation errors.
Add or remove errors from the collection to modify the result of the validation.
public IList<ValidationError> ValidationErrors { get; set; }
Property Value
- IList<ValidationError>
- A list of validation errors.