Hi
I have replaced the add to cart button by a a list of all the variations , so the user can add all variations (with different quantity) at the same time (I can have around 50 variations per product display). The problem is when the cart is getting bigger, adding to the cart get slower, and slower.
This is mainly because the commerce_cart_product_add called for every line added to the cart, resave the all cart. So when I'm adding 50 variations to a cart of 500 items, Those 500 items are saved 50 times.
The work around I found is to modify the commerce_cart_product_add to take a list of items instead of one and it work really well. However it's a hack, and it would be nice if a such function was available in commerce_cart.
Comments
Comment #1
elax commentedComment #2
joelpittetI've done something similar, when switching domains/languages. I check all the products have equivalent products for that domain and empty the cart and add all the new domain's products to their cart with a notification if there were any missing in translation.
If the cart has many items in it there is an commerce_cart_order_load and commerce_order_save on X line items.
This would be nice. @elax mind sharing your hacked function?