Hi there,
I am trying to set some defaults on a cart coming from an external system. I thought CartCreated would be a good idea, so I implemented the following:
[Subscribe(eCommerce.Cart.Created)]
public class AssignUserData : NotificationSubscriber
{
public override void OnNotify(string notification, NotificationArgs args)
{
if (!(args is eCommerce.Cart.CreatedArgs))
{
return;
}
var cArgs = (eCommerce.Cart.CreatedArgs) args;
{
cArgs.Order.CustomerCompany = "Default name";
cArgs.Order.CustomerAddress = "Default address";
cArgs.Order.Save(); // tried it with and without this call
}
}
}
The code runs fine, but none of the changes are applied. Is CartCreated too early to do this? Is there a better way?
Thanks,
Imar