How to Skip Cart Page in Magento



In this tutorial I will explain how you can skip cart page in Magento. If you want to go straight on checkout page on product add to cart button click, this tutorial will help you.

Create a custom module and change in config.xml file and create an event.
app/code/local/Yourmodule/Cart/etc/config.xml

<checkout_cart_add_product_complete>
	<observers>
		<yourmodule_cartbypass_observer>
			<type>singleton</type>
			<class>Yourmodule_Cart_Model_Observer</class>
			<method>afterAddToCart</method>
		</yourmodule_cartbypass_observer>
	</observers>
</checkout_cart_add_product_complete>

Now create a observer file and add below code.
/app/code/local/Yourmodule/Cart/Model/Observer.php

class Yourmodule_Cart_Model_Observer extends Varien_Object
{
	public function afterAddToCart(Varien_Event_Observer $observer) {
		$response = $observer->getResponse();

		$response->setRedirect(Mage::getUrl('checkout/onepage'));
		Mage::getSingleton('checkout/session')->setNoCartRedirect(true);
	}
}

I hope this tutorial will help you to skip cart page and direct move to checkout page after add to cart button.