I have a store with different customer group.in which all customer has a specific discount for all product.Suppose customer group A has 10 customer and discount is also 10% on all product. Discount is decided from one of my API site so it's a real time discount for different customer group When customer logging in that belongs to customer group A he/she is able to see price with 10% discount every where (Product listing,product view,and with whole check out process.)
i can achieve this by calling below code but it display only on cart page not every where.
checkout_cart_product_add_after
observer function
$item = $observer->getQuoteItem();
$product = $observer->getProduct();
$price = $product->getPrice();
//print_r($item->toArray());exit;
// Discounted 25% off
$percentDiscount = 0.25;
// This makes sure the discount isn't applied over and over when refreshing
$specialPrice = $product->getPrice() - ($product->getPrice() * $percentDiscount);
// Make sure we don't have a negative
if($specialPrice>0){
$item->setCustomPrice($specialPrice);
$item->setOriginalCustomPrice($specialPrice);
$item->getProduct()->setIsSuperMode(true);
}
How can i achieve this Please help