'Magento1 - REST API based add to cart missing catalog rule
We have a custom APIs for quote creation for guest and adding the products to cart. Everything is working fine except catalog rule based price is not coming in cart.
First API, which returns the quote id.
$quote = Mage::getModel('sales/quote');
$quote->setStoreId(1)
->setIsActive(true)
->setIsMultiShipping(false)
->setCustomerGroupId(Mage_Customer_Model_Group::NOT_LOGGED_IN_ID)
->setCustomerIsGuest(true)
->save();
Product adding API with quote.
$request = new Varien_Object();
$request->setData($options);
$quote->addProduct($product, $request);
Updated all catalog pricing rules and applied all rules.
When adding the product from magento UI and admin panel, its working fine. We have only one store. So whats is missing here ?
Also we cannot getting the price after rule when taking the product final price with below code.
$product->getFinalPrice();
But its getting if we taking the price by below method.
$final_price = Mage::getModel('catalogrule/rule')->calcProductPriceRule($product->setStoreId('1')->setCustomerGroupId('0'),$product->getPrice());
Whats the issue here ?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
