I also asked here https://magento.stackexchange.com/questions/167982/magento-1-9-x-how-to-add-an-extra-fee-to-order-while-adding-item-to-cart-progra but didn't get any answer yet so I am asking here.
I am adding item programmatically into cart (code below) and want to add an extra fee to order. I found a lot of results here also but unable to follow as I am new in magento. Can anyone please share where to create file (observer, config.xml etc with path) and what should be the name of the file? Below code is adding item to cart successfully but I am unable to add fee to complete order.
Any help will be really appreciable.
Thanks in advance. My code is:
$productId = 13114;
$price_extra = 50.00;
$product_model = Mage::getModel('catalog/product');
$code = Mage::app()->getStore()->getCode();
$_product = Mage::getModel('catalog/product')->load($productId);
$_product->setMinimalPrice($price_extra);
$cart = Mage::getSingleton('checkout/cart');
$cart->init();
$params = array(
'product' => $productId,
'related_product' => null,
'qty' => 1,
'options' => array(
2 => array('7', '8', '9', '10', '11', '12'),
1 => array('1', '2', '3', '4', '5', '6'),
)
);
$customer = Mage::getSingleton('customer/session')->getCustomer();
$storeId = $customer->getStoreId();
$cart->addProduct($_product, $params);
$cart->save();
Mage::getSingleton('checkout/session')->setCartWasUpdated(true);
100
and you want to make it150
before adding to cart?? @Pankaj – Klaus Mikaelson