Magento Programmatically Add Product to Cart (For Simple Products).

Sometimes, customers specifications exceed the defaults built into the Magento. We need to add products into cart programmatically in a controller. Below are a few code snippets which can be used to add products to cart.

Examples of add products to cart with customized options programmatically in Magento.

1. Simple Products

Url Example: http://example.com/checkout/cart/add?product=13&qty=1&options[12]=57

By Product ID:

By SKU:

Leave a Reply

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