Can anyone tell me in magento, when we click Add to Cart button in product detail page, where and how is Product Price and Qty input multiplied and updated in shopping cart page Subtotal column. I want to customize the action for my custom pricing module.

  • what you mean by customize the action for my custom pricing module.
    – Amit Bera
    Jun 16, 2015 at 11:26
  • By default, magento takes the prod price and qty as separate parameters and multiply them during Add to Cart event to display subtotal in cart page. But I am performing custom price calculation in product page itself and updating the custom price using ajax. Now I want my custom price to be displayed in cart page sub total column alone. But the same price is displayed both in unit price and subtotal columns. Also I want to prevent default multiply action on Add to cart. Jun 16, 2015 at 11:42
  • Amit pl let me know if u can help me with this issue. Jun 16, 2015 at 11:47
  • that means you can change cart item price and subtotal?
    – Amit Bera
    Jun 16, 2015 at 11:49

2 Answers 2


The subtotal logic on the cart page is implemented in the below template file.


Override this file into your local and modify it as per your requirement.

  • thank you for the reply.. can u pls tell me how does the subtotal in cart page logic goes in while clicking Add to Cart in PDP (product price * qty) Jun 16, 2015 at 10:51
  • check my updated answer Jun 16, 2015 at 11:09
  • btw is it poss for u to answer my another query too? Jun 17, 2015 at 5:04

Guess that

You want to change cart item unit price.I

So in this case,you can use magento event/observer. Basically there are two events,by which you can change the cart price of that products:

  1. checkout_cart_product_add_after
  2. checkout_cart_update_items_after
  3. checkout_cart_product_update_after

This 3 event is need because of:


This event is fire when first time a product is cart for current session of current input values from frontend


This event is fire when a current exiting cart item edited from edit link of cart item.


This event is fire whenever cart items update from cart page.

As per as magento system, a cart item price change using setter functions setCustomPrice(), setOriginalCustomPrice of cart item Object.

Just like:

// Enable super mode on the product.

If you can cart each unit price then automatically change subtotal

An example: Custom options operations

  • Thank u Amit. I have set the new price and it's updated in quote table using event/obs. The problem is, I'm changing the Prod Price displayed in my pdp using ajax when my customer enters a number. Along with tat I'm using several parameters and calculating the custom prod price. It's updated in the same div where magento displays the unit price frm backend. So when I add to cart, the unit price in cart is getting updated as my custom price. I wanna stop it. Also I need to prevent the prod price * qty functionality. Jun 16, 2015 at 12:59

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.