Adding a Product to the cart by Product ID


Adding a simple product into cart :

Suppose : id = 2880 (Product id)
qty = 2 (No of product quantity add into cart).

http://yourstoreurl/checkout/cart/add/product/[id]/qty/[qty]
example : http://domainname.com/checkout/cart/add/product/2880/qty/2

or

http://yourstoreurl/checkout/cart/add?product=[id]&qty=[qty]
example : http://domainname.com/checkout/cart/add?product=2880&qty=2


Adding a bundle product into cart :

Suppose : id = 1313 (Product id)
qty = 2 (No of bundle product quantity add into cart).

For bundle product we need Option ID – [option_id] and selected value – [selection_id] of bundle options.

To get option id and its selected value :
- We need to get the [option_id] and the [selection_id] from the catalog_product_bundle_selection table in our database.
or
- Go to product detail page and using firebug you can collect Option id and value for each option.

http://yourstoreurl/checkout/cart/add/product/[id]/?bundle_option[[option_id]][]=[selection_id]
example : http://domainname.com/checkout/cart/add/product/1313/qty/2/?bundle_option[28]=6&bundle_option[26]=9&bundle_option[24]=12