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?