Menu Close
    Start a Project Request quote Reading list Switch to dark mode
    opencart-hyperlocal-marketplace-guide

    Create simple shipping module in Opencart

    In our previous blogs, we learned to create a module in Opencart. Now, we learn to build a simple shipping module in Opencart. Shipping is one of the major part of an e-commerce website. So, we must learn this part for the Opencart.

    For building a shipping module, we will first create a file named simple_shipping.php in admin->language->en-gb->shipping. Here’s our language file:


    Now, we will create a file named ‘simple_shipping.php’ in admin->controller->shipping (Opencart version 2.2.0.0). Here’s the code of the controller file.


    Now, we will create a file named simple_shipping.tpl in admin->view->template->shipping. Here’s the code for this file:


    As we have to show the shipping cost in the front end. So, we need to create some files in the front end as well and this is the main part of shipping module as well. In the front end, we just need to create two files viz. language file and model file. The shipping calculation is done in the language file.

    So, in the front end, we will first create a language file named simple_shipping.php in the catalog->language->en-gb->shipping(Opencart version 2.2.0.0). The language part is here:


    Now, we will head towards the model file of the shipping. This is the most important file as all the calculations are conducted in this file itself.

    So, we will create a file named simple_shipping.php in catalog->model->shipping(Opencart version 2.2.0.0). The model file name must be same as the controller name in the backend, otherwise, the shipping will not be detected by the Opencart. You can make a lot of calculations in this file, I haven’t made any. Here’s the code of model file:


    So, we have completed building our simple shipping module. Now, we will install the shipping by heading to Extensions->Shipping->Simple Shipping from the admin panel and after installing you can configure the shipping by enabling it.

    When you will go to the checkout page, we will have a look like this. See image:

    Hope, you will get an idea of building a shipping module in Opencart. In the case of any query, just comment.

    . . .

    Comments (3)

    Add Your Comment

  • Dare
    Good one and very educative.
    Can you please convert this to openCart 3XXX?
  • DeadSEC Ninja
    Hi- how can we get more elements in front-end like getting a pickup point selection or delivery date selection widget? I assume we use VQmod but have no idea how to or where to start.
    • Vikhyat Sharma
      Yes, you are right, you have to use VQmod or OCmod to put extra fields as Opencart has a predefined format for the shipping methods. In order to put more fields like pickup point selection and delivery date selection, you have modify the checkout/shipping_method.tpl view file for your shipping method. And later you can perform operations as per you.
  • Back to Top
    css.php
    Hire Us!
    Brief us about your requirements and we'll get back to you.
    Woo! Hooy!
    We have just recieved your project brief and our expert will contact you shortly.
    Send Again
    Close