Add to cart redirect to Cart page or checkout on opencart 1.5.2.

Posted by Flo on 28 Jun 2012

If you want to redirect your customer to cart page or checkout page after he added a product to cart, here is how you do it.

(This applies to opencart 1.5.2.x and 1.5.3.x)

Edit the files: catalog/view/javascript/common.js and catalog/view/theme/yourtheme/template/product/product.tpl and in each file, make the following modification:

Find the code:

if (json['success']) {
$('#notification').html('<div class="success" style="display: none;">' + json['success'] + '<img src="catalog/view/theme/default/image/close.png" alt="" class="close" /></div>');



$('html, body').animate({ scrollTop: 0 }, 'slow');

And, if you want to redirect to checkout page, replace it with;

if (json['success']) {

Or, if you want it to redirect to cart page, replace it with:

if (json['success']) {


That is all, I hope you'll enjoy it.