I want to add bundle product to add to cart from external php file and it is successfully adding but it is taking long time approx 30sec.


include 'app/Mage.php';

$size = 2;

$productId = 123; // bundle product

$product = Mage::getModel('catalog/product')

$session =  Mage::getSingleton("core/session", array("name" => "frontend")); // frontend session

//cart params
$cartParams = array(
            'product' => $productId,
            'related_product' => null,
            'bundle_option' => array(
                '3'=> '176399802',
                '4' => '176420135'
            'qty' => 1,
    $cart = Mage::getModel('checkout/cart'); // cart object
    $cart->addProduct($product, $cartParams);
    echo Mage::getModel('checkout/cart')->getQuote()->getItemsCount();
}catch(Exception $e){
    echo $e->getMessage(); 

and when I perform any action to cart page it is also taking time. Actions like ( load cart page, delete items etc )

Please look into this and help me to sort out this problem.

Any help would be appreciated


1 Answer 1


I have fixed slow add to cart issue for bundle product.

As I have gone through deeply and found that there are lot of bundle selection products( approx 20,000). I have created another bundle product with 10 bundle selection product and it worked fine and took 5 second.

As we know that when we add to cart the product, we call $cart->addProduct($product,$params);

where $product is object of product and $params is an array with respective selections product.

Due to lot of selection product, it is taking time during add to cart.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.