What is the Order total in Opencart 4? How to apply and create them?

In Opencart Order total modules are those which decrease or increase the total price of the total order. Some of the order total which decreases the total price are coupons, store credits, reward points, etc. Some of the order totals which increases the total price are Handling fees, low order fees, taxes, etc. You can see order totals by going to Admin >> Extensions >> Extensions >> Choose the extension type Order Totals, then you will see all the order totals. Some of the default order totals are the following: 

  • Coupon
  • Store Credit
  • Handling Fee
  • Klarna Fee
  • Low Order Fee
  • Reward Points
  • Shipping
  • Sub-total
  • Taxes
  • Total
  • Gift Voucher

How to install the Order total in Opencart?

Go to Admin >> Extensions >> Extensions >> Choose the extension type “Order Totals” and click the install button that you want to install and Edit it, Enabled it and click Save.

Order totals affect the total price of order so they are placed in the order total so you will find the order total at the shopping cart page and the confirmation page of the order.

Order total in Opencart

Why shipping is not showing in Opencart?

First, check if the shipping order total is enabled or not. If it is not enabled then we need to enabled it. Next is to check for the Geozone setting of Opencart for the products.

How to apply and create the Order total in Opencart?

When we install the Order total modules then it is stored as ‘total’ code in the oc_extension database table. Check the following code how it pulls all the enabled Order total and applied it to the order total costs.

$results = $this->model_setting_extension->getExtensions('total');
foreach ($results as $key => $value) {
    $sort_order[$key] = $this->config->get('total_' . $value['code'] . '_sort_order');
}
array_multisort($sort_order, SORT_ASC, $results);
foreach ($results as $result) {
    if ($this->config->get('total_' . $result['code'] . '_status')) {
        $this->load->model('extension/total/' . $result['code']);
        // We have to put the totals in an array so that they pass by reference.
        $this->{'model_extension_total_' . $result['code']}->getTotal($total_data);
    }
}

We hope this post may help you understand the Order total of Opencart 3. Let us know if you have any questions or suggestions, please subscribe to our YouTube Channel for Opencart video tutorials. You can also find us on Twitter and Facebook. Enjoy!

Previous articleHow to install and create Opencart 4 theme – user manual and developer guide?
Next articleHow to add HTML, google analytics, tag manager, third party JS code in Opencart
Author of three Opencart book. The recent Opencart 4 book is at https://amzn.to/4dOlbOR

LEAVE A REPLY

Please enter your comment!
Please enter your name here