Add article to cart gives "RemovedDueToCodeMissing"

Vote:
 

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

#323199
Jun 06, 2024 21:24
Vote:
 

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. :-)

Evdin

#323200
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.