Discount codes not showing at checkout in OpenCart 1.5

A few weeks ago, we had a client using OpenCart 1.5 as their ecommerce software with a customised ‘default’ theme, who noticed that discount codes were not showing at checkout in OpenCart 1.5. The closest guide we found was on the OpenCart community forums, but wasn’t coherent enough to follow in places, so here is our attempt at clarifying the problem!

1. Ensure you have added coupon codes!

The first obvious check is to ensure you have added voucher (discount) codes to your store through OpenCart’s administration panel, in Sales > Coupons.

OpenCart 1.5 Sales > Coupons screen

2. Ensure Coupons are enabled in OpenCart

Next, we need to check the coupons feature is enabled in OpenCart. In OpenCart 1.5+, this is located in the Extensions > Order Totals menu in the administration panel. Make sure that the Coupons feature is enabled (it should be by default).

OpenCart 1.5 Extensions > Order Totals menu

3. The fix: change all links to OpenCart checkout to OpenCart cart

This bit is the painful task. If you look at example.com/index.php?route=checkout/cart, you should see the Coupon Code section within the checkout process, but if you look at example.com/index.php?route=checkout/checkout, you’ll see it’s not there at all.

Simply, OpenCart links to the checkout page, and not the cart page, which is where it stores the discount code. So, to fix discount coupons not showing at the checkout in OpenCart 1.5, you need to change most links in your OpenCart templates from index.php?route=checkout/cart to index.php?route=checkout/checkout. To do this, look for:

<a href="<?php echo $checkout; ?>" ...

and correct these instances to the below:

<a href="<?php echo $cart; ?>" ...

(an IDE such as Eclipse allows for project-wide find and replace). Done!

Still not clear? We offer OpenCart consultancy if you’re not confident enough to do it yourself!

This entry was posted in Client projects, Hints and tips, OpenCart. Bookmark the permalink.

9 Responses to Discount codes not showing at checkout in OpenCart 1.5

  1. Hozefa says:

    Hi,

    I think we don’t have to replace each instance of $checkout with $cart. We just need to modify the file (header.tpl) in common directory of the theme we are using. In the main menu it shows both links for cart and checkout, if we replace the link of checkout with cart then everybody first have to goto cart page and they see coupon code there and then they click on checkout button there to go to checkout process.

    Thanks
    Hozefa

    • admin says:

      Thanks Hozefa. I assumed the same initially, but there were some instances of $cart that needed replacing elsewhere, not just in the header.tpl file.

  2. Dave says:

    Is there any code I can input that will automatically store all redeemed valid voucher codes int a .txt?

    Any answers would be greatly appreciated

    • Richard says:

      I’d imagine you could do that with a look through the OpenCart database (look in the voucher table), and run a query for all redeemed vouchers (there’s a field called status), then output to whatever you want.

      Hope that helps!

  3. Dave says:

    Thats Great, Thanks, I will give this a go!

  4. Laurie Green says:

    The fix is located here

    go to catalog/view/theme/’themename’/template/module/cart.php

    Line 46
    <a class="button" href="”>

    To
    <a class="button" href="”>

  5. Pingback: [SOLVED] Change cart drop down link (urgent help) | Open Cart Know How

  6. Pingback: coupon, gift voucher can’t be applied.. | Open Cart Know How

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>