Today, we’re going to discuss one of the important and useful features of OpenCart called “Order Totals”. I’m sure that you’re already using it to some extent, but you may not be aware of that. So you’ll be surprised when we’ll discuss a couple of examples of this kind of extension.
We’ll use the latest version of OpenCart. So let’s start the journey by looking at what exactly “Order Totals” extensions are all about.
What Are "Order Totals"?
In simple terms, you could think of an “Order Totals” extension as a way to intercept the checkout flow and alter the important order-related information. Specifically, it’s useful to add further charges to the total order amount, or you could use it to provide a discount on the total order amount.
In some cases, this kind of extension is useful to display specific information on the cart and checkout pages. You may be wondering, but the “Total” displayed on the cart page is itself an “Order Totals” extension. Let’s enable it and see how it works in the front-end.
In the back-end, go to Extensions > Order Totals, and install and enable the Total extension if it’s not installed already. Now, head over to the front-end, add a couple of products to the cart, and visit the cart page.
So, as you can see, the Total is displayed at the bottom of the page, which is displayed by the Total order totals extension.
We’ll also look at a couple of other extensions in the next section.
A Glance at Various Extensions
Head over to the admin side and go to Extensions > Order Totals page. You’ll see a list of all the order totals extensions.
Although there are lots of extensions available in the core, you could categorize them in three major types.
Format and Display Specific Information
As I mentioned earlier, there are certain order totals extensions which are useful to format and display certain order specific information. Let’s have a look at the quick list.
Make sure that Sub-Total and Total extensions are installed and you’ll see that the corresponding rows are added for both extensions on the cart page.
Add Extra Charges to the Order Total
This kind of extension allows you to add certain extra charges to the amount of the order. It could be in any form like taxes, a handling fee, or something else. Listed below are the order totals extensions which add an extra charge to the order total amount in different forms.
- Low Order Fee
- Klarna Fee
- Handling Fee
Let’s have a look at one of these extensions to get an idea of what exactly they are used for. Go ahead and install the Low Order Fee extension, as shown in the following screenshot.
I’ve entered 600 in the Order Total field, 50 in the Fee field, and set the Status to Enabled. It means that if my total order amount is less than 600, I’ll have to pay an extra fee of 50. On the other hand, if the total order amount is greater than or equal to 600, the low order fee will be ignored.
Save the values and add a couple of products in the front-end so that the total remains under 600. As you can see, an extra fee of $50 is added and displayed!
Go ahead and enable other similar extensions and check the result!
Provide a Discount on the Order Total
Using this kind of extension, you could allow the user to claim a discount on the total order amount. Here’s a quick list of such extensions.
- Store Credit
- Gift Voucher
- Reward Points
Again, let’s enable Coupon and see how it works. Go ahead and install the Coupon, and make sure to set the Status to Enabled. In the front-end, enter the coupon code in the Use Coupon Code section as shown in the following screenshot. Of course, you need to add the coupon code in the Marketing > Coupons section if you haven't already.
It’s formatted and shown by the Coupon order totals extension!
What You Could Do With "Order Totals"
By now, you should be familiar with the concept of the order totals extension. The important thing is that OpenCart allows you to create your own custom order totals extension for custom use cases. You just need to create a couple of files in the back-end and front-end to plug in your custom order total extension.
There are various use cases in which you might want to implement your own custom order totals extension. For example, say you would like to impose an extra tax based on the shipping address, or perhaps you want to provide a discount for certain regions. The possibilities are endless.
Hopefully, I’ll come up with a tutorial which will explain how to create your own order totals extension.
Today, we’ve discussed “Order totals”, which is one of the important features in OpenCart. We went through different types of order totals extensions and discussed their usage as well.
As always, if you're looking for additional OpenCart tools, utilities, extensions, and so on that you can leverage in your own projects or for your own education, don't forget to see what we have available in the marketplace.
I hope that this is something you can use for your website. Queries and suggestions are always welcome.
Envato Tuts+ tutorials are translated into other languages by our community members—you can be involved too!Translate this post