UpdateShoppingCartItemUnits problem with vanishing ship-to address

Bart Lewandowski asked on July 31, 2019 13:18

Hi,

I'm using modified script from Kentico website (https://docs.kentico.com/api11/e-commerce/shopping-carts) to change the quantity of units on the basket level. It works great apart from one small detail. Every time it is called it blanks the ship-to/bill-to address and it needs to be keyed in again which is a little bit inconvenient. Another function from this page which is deleting item from basket does not cause that issue. I did some debugging and I found that the function ShoppingCartItemInfoProvider.UpdateShoppingCartItemUnits is a culprit, but I have no idea why, as it shouldn't have anything to do with addresses. Is it by design or could be a bug? I also tried to go around the problem by saving the addresses id's to variables and restoring them after calling this function with cart.SetValue, but I probably don't do it right and i'm getting the foreign key restrain errors. Is there any other workaround which would help me to re-assign the shipping and billing address to the basket?

Best regards, Bart

Recent Answers


Bart Lewandowski answered on July 31, 2019 14:22

I looked into it some more. It seems that the same happens whenever you add a new item from catalogue level with uc1:CartItemSelector. So I suppose ShoppingCartItemInfoProvider.UpdateShoppingCartItemUnits function is deleting the line and re-insert it with new qty using the same method as uc1:CartItemSelector. The question is now - why the shopping basket line creation would delete the shipping details?

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.