Update multiple shopping cart items to cart using API

Naresh Ede asked on August 9, 2024 07:54

Hi,

I am using Kentico 13, dotnet core application. I wanted to update multiple products to cart in a single database call.

Currently I am looping through all products and updating one by one which is taking very long.

//for loop start
    shoppingCartItemInfoProvider.Set(cartItem);
//for loop end

Is there a way to convert all the insert statements into single query and insert them once so that the performance will get improved.

Thanks.

Recent Answers


Ben Quinlan answered on August 29, 2024 03:39

Unfortunately, I don't not believe there is currently any capability within the InfoProvider objects provided by Kentico to support bulk inserts or updates, although I am happy to be corrected.

The info objects typically map directly to a database table, so it would be possible to leverage another library to make these changes directly. I would strongly recommend against this approach though, as circumventing the InfoProvider would mean that any additional code or events related to the setting of a ShoppingCartItemInfo would not be triggered.

0 votesVote for this answer Mark as a Correct answer

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