Quantcast
Channel: Customized Commerce 13 and earlier versions
Viewing all articles
Browse latest Browse all 9642

Add article to cart gives "RemovedDueToCodeMissing"

$
0
0

Hello,

I will not get in too many useless details, but the problem is pretty simple - I'm adding an article (variant) to the shopping cart:

Guid contactId = PrincipalInfo.CurrentPrincipal.GetContactId();
ICart cart = this.orderRepository.LoadOrCreateCart<ICart>(contactId, "Default");
ILineItem? shoppingCartLineItem =
            cart.GetAllLineItems().FirstOrDefault(lineItem => lineItem.Code == currentArticle.Code);
        if (shoppingCartLineItem == null)
        {
            // we have to add the product to the shopping cart.
            shoppingCartLineItem = cart.CreateLineItem(currentArticle.Code, this.orderGroupFactory);
            shoppingCartLineItem.Quantity = quantity;
            cart.AddLineItem(shoppingCartLineItem);
        }
        else
        {
            decimal totalQuantity = quantity + shoppingCartLineItem.Quantity;
            IShipment shipment = cart.GetFirstShipment();
            cart.UpdateLineItemQuantity(shipment, shoppingCartLineItem, quantity);
        }
IDictionary<ILineItem, IList<ValidationIssue>> shoppingCartValidationResult =
            this.orderValidationService.ValidateOrder(cart);

When I validate the shopping cart, I get this error: `RemovedDueToCodeMissing` and I totally don't understand why - what am I missing - the stock is there, the current market and the price is there - everything is correctly setip but there is something that I'm missing and I don't understand what. Can you please give me some hints?

Thank you,

Evdin


Viewing all articles
Browse latest Browse all 9642

Trending Articles