Magento: Programmatically Add Bundle Product to Cart.

Recently we came across a task that among other things required manipulation of bundle products in Magento. Here is little code snippet that helped Programmatically adds bundle product to cart.

There are in above code snippet have two significant things to keep an eye on bundle product view page, custom options and bundle items.

Custom options are set in the array

And bundle item options are set in array

Output screenshot
output
In above code snippet you need to do is to pass the proper field name-values as a params and then you can use this code from within controller or as a fast fix from within view file.

Leave a Reply

Your email address will not be published. Required fields are marked *