SaaS CMS has officially launched! Learn more now.

Add article to cart gives "RemovedDueToCodeMissing"



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;

            decimal totalQuantity = quantity + shoppingCartLineItem.Quantity;
            IShipment shipment = cart.GetFirstShipment();

            cart.UpdateLineItemQuantity(shipment, shoppingCartLineItem, quantity);

IDictionary<ILineItem, IList<ValidationIssue>> shoppingCartValidationResult =

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,


Jun 06, 2024 21:24

OK, I figured it out - it was pretty simple - we had in the shopping cart an article that didn't exist anymore. Always check the shopping cart content for things that has nothing to do with the current article. :-)


Jun 06, 2024 21:28
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.