I am developing a Magento 2 shop with a (bundle) product configurator and a side bar which should contain the current cart, including shipping cost and discount (for example 5% for orders > 100€).

I already modified the bundle product view to contain the cart sidebar from the checkout (that was fun).

Basically I am at the URL checkout/cart/configure/id/251/product_id/1/. Here 251 is the cart item ID.

Now I am thinking about submitting the product configuration on every Javascript change event of the product configuration.

But I saw, that the item ID always changes. I digged down into \Magento\Checkout\Controller\Cart\UpdateItemOptions::execute and saw, that Magento removes and re-adds the cart items.

While I think my approach would basically work out in some way, it would have the draw back of excessive creation and deletion of cart items while the users is clicking around at the product configurator.

Is there a smarter way to accomplish such kind of a cart-preview during product configuration?

1 Answer 1


Standard way of making UI more responsive while not adding load on server is to do operations in javascript and later do one bulk update to server. You can use smth. like Unit Of Work in your javascript application to collect actions that should be sent to server

The scope of actions that you can support in this way is pretty limited because many modules influence "add to cart" operation on server through observers and plugins, so you will have to re-create that behavior in browser.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.