Below is the code to add multiple products programmatically. It can be used to add one product. Put this code in a file called test.php on your root site, and then run it like this: /test.php? Products_ids = 11,9,10, where 11, 9,10 are 3 products. Hope this helps.
<?php require(dirname(__FILE__).'/config/config.inc.php'); $context=Context::getContext();//new Cart(); $id_cart=$context->cookie->__get('id_cart'); $products_ids=$_GET['products_ids']; // comma seprated products id example : test.php?products_ids=1,2,3 $products_ids_array=explode(",",$products_ids); if(count($products_ids_array)>0){ $cart=new Cart($id_cart); $cart->id_currency=2; $cart->id_lang=1; foreach($products_ids_array as $key=>$id_product){ $cart->updateQty(1, $id_product); } } ?>
source share