How to add extra product while creating order from admin only. Let's say I added "test1" product from admin, so "test2" product will be added automatically to that order.

I have created Observer for that.


For your sales_quote_item_set_product event try this:

public function addProduct(Varien_Event_Observer $observer)
    $product = $observer->getProduct();
    if ($product->getSku() == 'test1') {
        $added = false;
        $quote = $observer->getQuoteItem();
        foreach ($quote->getQuote()->getAllVisibleItems() as $item) {
            if ($item->getProduct()->getSku() == 'test1') {
                $added = true;

        if (!$added) {
            $addProduct = Mage::getModel('catalog/product');

If this should be for admin only make sure sales_quote_item_set_product is not set globally - it should be placed here:

  • but there is an issue if we are removing that test1 product its adding one more time ? Jun 20 '17 at 9:02
  • Mhhh? Can't reproduce ... I can remove "test1" w/o any problems? Maybe another observer?
    – sv3n
    Jun 20 '17 at 9:44
  • after product add to order click on apply coupon button on that button click also that test2 products qty is increasing on every click its changing qty & price Jun 20 '17 at 9:56
  • Please try updated code.
    – sv3n
    Jun 20 '17 at 10:37
  • After add product to order first remove test2 product individually & then remove test 1 product individually you will see on remove test 2 product is adding there Jun 20 '17 at 10:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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