I have BuyNow button on my product page when I clicked on button it should redirect to checkout page and product should be added to cart page, please tell me proper solution over this how to do this.


4 Answers 4


Swash_nam, Goto cartcontroller (app>code>core>Mage>Checkout>controllers>CartController.php)'s function goback


Go to Admin>Configuration>Sales>Checkout>Shopping Cart>After Adding a Product Redirect to Shopping Cart and make it yes

  • Unless I am missing something in the question as @Amit shows above this is just a setting.
    – joesk
    Sep 16, 2016 at 16:05

If anyone suggest that you should make changes to core code, ignore it! Making changes to core files is a Bad Thing and every Magento developer worth its salt avoids it at all costs.

That being said there's number of ways to achieve it. I would use observers. There's an excellent tutorial from Inchoo about building an observer extension which deal with something similar. I'm not :


However, instead of controller_action_predispatch_checkout_cart_add, I would add_to_cart_after event.

Check also this article for the additional information:


To redirect Magento to checkout use something similar in the Observer code:

$response = $observer->getResponse();
$url = Mage::helper('checkout/url')->getCheckoutUrl();

Please check the answer form this post https://stackoverflow.com/a/4053248/3018289

Here is a copy for quick access.

You could create an observer listening for the checkout_cart_add_product_complete event and in there you could do something like the following

  public function addToCartComplete(Varien_Event_Observer $observer) {
    // Send the user to the Item added page
    $response = $observer->getResponse();
    $request = $observer->getRequest();

Your config would look something like this


There is a good tutorial to tell about how to create a module to make redirect cart to checkout more simple: https://bsscommerce.com/blog/magento-redirect-to-checkout-after-adding-to-cart-an-easy-how-to-guide/

I see that it give a detaied instruction aboutcreating a module by using envent Observer method the use config co control redirect cart to checkout

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.