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
using System;
namespace Dynamicweb.Ecommerce.Examples.Notifications.CartV2;
[Dynamicweb.Extensibility.Notifications.Subscribe(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 Ecommerce.Notifications.Ecommerce.Cart.BeforeOrderValidationArgs;
if (beforeValidationArgs is null)
return;
// Skip validation for countries other than US
if (!beforeValidationArgs.Order.DeliveryCountryCode.Equals("US", StringComparison.OrdinalIgnoreCase))
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
trueif [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.