{"id":376751,"date":"2023-04-14T10:03:03","date_gmt":"2023-04-14T10:03:03","guid":{"rendered":"https:\/\/webkul.com\/blog\/?p=376751"},"modified":"2023-04-20T06:48:15","modified_gmt":"2023-04-20T06:48:15","slug":"how-to-create-a-simple-shipping-method-in-opencart","status":"publish","type":"post","link":"https:\/\/webkul.com\/blog\/how-to-create-a-simple-shipping-method-in-opencart\/","title":{"rendered":"How to Create a Simple Shipping Method in Opencart?"},"content":{"rendered":"\n<p>In our previous blog, we learned to create a <a href=\"https:\/\/webkul.com\/blog\/create-first-basic-module-opencart\/\" target=\"_blank\" rel=\"noreferrer noopener\">module<\/a> in Opencart. Now, we learn to build a simple module in Opencart. Shipping is one of the major parts of an e-commerce website. So, we must learn this part&nbsp;for the Opencart.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Create A Language File For The Shipping Method <\/strong><\/h2>\n\n\n\n<p>In Order To Proceed, you will need to create a new Language file for your module. Subsequently, a file called &#8220;my_shipping.php&#8221; will be located in the &#8220;\/admin\/language\/en-gb\/extension\/shipping\/&#8221; directory.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">&lt;?php\n\/**\n * Webkul Software\n * \n * @category Webkul\n * @package Opencart Module Tutorial\n * @author &#091;Webkul] &lt;&#091;&lt;http:\/\/webkul.com\/&gt;]&gt;\n * @copyright Copyright (c) Webkul Software Private Limited (https:\/\/webkul.com)\n * @license https:\/\/store.webkul.com\/license.html\n *\/\n\/\/ Heading\n$_&#091;&#039;heading_title&#039;]    = &#039;My Shipping&#039;;\n\n\/\/ Text\n$_&#091;&#039;text_extension&#039;]   = &#039;Extensions&#039;;\n$_&#091;&#039;text_success&#039;]     = &#039;Success: You have modified My shipping!&#039;;\n$_&#091;&#039;text_edit&#039;]        = &#039;Edit My Shipping&#039;;\n\n\/\/ Entry\n$_&#091;&#039;entry_cost&#039;]       = &#039;Cost&#039;;\n$_&#091;&#039;entry_tax_class&#039;]  = &#039;Tax Class&#039;;\n$_&#091;&#039;entry_status&#039;]     = &#039;Status&#039;;\n$_&#091;&#039;entry_sort_order&#039;] = &#039;Sort Order&#039;;\n\n\/\/ Error\n$_&#091;&#039;error_permission&#039;] = &#039;Warning: You do not have permission to modify My shipping!&#039;;<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Create A Controller File For The Shipping Method <\/strong><\/h2>\n\n\n\n<p>In Order To Proceed, you will need to create a new PHP Controller file. As a result, you can create a file called &#8220;my_shipping.php&#8221; in the &#8220;\/admin\/controller\/extension\/shipping\/&#8221; directory.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">&lt;?php\n\/**\n * Webkul Software\n * \n * @category Webkul\n * @package Opencart Module Tutorial\n * @author &#091;Webkul] &lt;&#091;&lt;http:\/\/webkul.com\/&gt;]&gt;\n * @copyright Copyright (c) Webkul Software Private Limited (https:\/\/webkul.com)\n * @license https:\/\/store.webkul.com\/license.html\n *\/\nclass ControllerExtensionShippingMyShipping extends Controller\n{\n    private $error = array();\n\n    public function index()\n    {\n        $this-&gt;load-&gt;language(&#039;extension\/shipping\/my_shipping&#039;);\n\n        $this-&gt;document-&gt;setTitle($this-&gt;language-&gt;get(&#039;heading_title&#039;));\n\n        $this-&gt;load-&gt;model(&#039;setting\/setting&#039;);\n\n        if (($this-&gt;request-&gt;server&#091;&#039;REQUEST_METHOD&#039;] == &#039;POST&#039;) &amp;&amp; $this-&gt;validate()) {\n            $this-&gt;model_setting_setting-&gt;editSetting(&#039;shipping_my_shipping&#039;, $this-&gt;request-&gt;post);\n\n            $this-&gt;session-&gt;data&#091;&#039;success&#039;] = $this-&gt;language-&gt;get(&#039;text_success&#039;);\n\n            $this-&gt;response-&gt;redirect($this-&gt;url-&gt;link(&#039;marketplace\/extension&#039;, &#039;user_token=&#039; . $this-&gt;session-&gt;data&#091;&#039;user_token&#039;] . &#039;&amp;type=shipping&#039;, true));\n        }\n\n        if (isset($this-&gt;error&#091;&#039;warning&#039;])) {\n            $data&#091;&#039;error_warning&#039;] = $this-&gt;error&#091;&#039;warning&#039;];\n        } else {\n            $data&#091;&#039;error_warning&#039;] = &#039;&#039;;\n        }\n\n        $data&#091;&#039;breadcrumbs&#039;] = array();\n\n        $data&#091;&#039;breadcrumbs&#039;]&#091;] = array(\n            &#039;text&#039; =&gt; $this-&gt;language-&gt;get(&#039;text_home&#039;),\n            &#039;href&#039; =&gt; $this-&gt;url-&gt;link(&#039;common\/dashboard&#039;, &#039;user_token=&#039; . $this-&gt;session-&gt;data&#091;&#039;user_token&#039;], true)\n        );\n\n        $data&#091;&#039;breadcrumbs&#039;]&#091;] = array(\n            &#039;text&#039; =&gt; $this-&gt;language-&gt;get(&#039;text_extension&#039;),\n            &#039;href&#039; =&gt; $this-&gt;url-&gt;link(&#039;marketplace\/extension&#039;, &#039;user_token=&#039; . $this-&gt;session-&gt;data&#091;&#039;user_token&#039;] . &#039;&amp;type=shipping&#039;, true)\n        );\n\n        $data&#091;&#039;breadcrumbs&#039;]&#091;] = array(\n            &#039;text&#039; =&gt; $this-&gt;language-&gt;get(&#039;heading_title&#039;),\n            &#039;href&#039; =&gt; $this-&gt;url-&gt;link(&#039;extension\/shipping\/my_shipping&#039;, &#039;user_token=&#039; . $this-&gt;session-&gt;data&#091;&#039;user_token&#039;], true)\n        );\n\n        $data&#091;&#039;action&#039;] = $this-&gt;url-&gt;link(&#039;extension\/shipping\/my_shipping&#039;, &#039;user_token=&#039; . $this-&gt;session-&gt;data&#091;&#039;user_token&#039;], true);\n\n        $data&#091;&#039;cancel&#039;] = $this-&gt;url-&gt;link(&#039;marketplace\/extension&#039;, &#039;user_token=&#039; . $this-&gt;session-&gt;data&#091;&#039;user_token&#039;] . &#039;&amp;type=shipping&#039;, true);\n\n        if (isset($this-&gt;request-&gt;post&#091;&#039;shipping_my_shipping_cost&#039;])) {\n            $data&#091;&#039;shipping_my_shipping_cost&#039;] = $this-&gt;request-&gt;post&#091;&#039;shipping_my_shipping_cost&#039;];\n        } else {\n            $data&#091;&#039;shipping_my_shipping_cost&#039;] = $this-&gt;config-&gt;get(&#039;shipping_my_shipping_cost&#039;);\n        }\n\n        if (isset($this-&gt;request-&gt;post&#091;&#039;shipping_my_shipping_tax_class_id&#039;])) {\n\t\t\t$data&#091;&#039;shipping_my_shipping_tax_class_id&#039;] = $this-&gt;request-&gt;post&#091;&#039;shipping_my_shipping_tax_class_id&#039;];\n\t\t} else {\n\t\t\t$data&#091;&#039;shipping_my_shipping_tax_class_id&#039;] = $this-&gt;config-&gt;get(&#039;shipping_my_shipping_tax_class_id&#039;);\n\t\t}\n\n\t\t$this-&gt;load-&gt;model(&#039;localisation\/tax_class&#039;);\n\n\t\t$data&#091;&#039;tax_classes&#039;] = $this-&gt;model_localisation_tax_class-&gt;getTaxClasses();\n\n        if (isset($this-&gt;request-&gt;post&#091;&#039;shipping_my_shipping_status&#039;])) {\n            $data&#091;&#039;shipping_my_shipping_status&#039;] = $this-&gt;request-&gt;post&#091;&#039;shipping_my_shipping_status&#039;];\n        } else {\n            $data&#091;&#039;shipping_my_shipping_status&#039;] = $this-&gt;config-&gt;get(&#039;shipping_my_shipping_status&#039;);\n        }\n\n        if (isset($this-&gt;request-&gt;post&#091;&#039;shipping_my_shipping_sort_order&#039;])) {\n            $data&#091;&#039;shipping_my_shipping_sort_order&#039;] = $this-&gt;request-&gt;post&#091;&#039;shipping_my_shipping_sort_order&#039;];\n        } else {\n            $data&#091;&#039;shipping_my_shipping_sort_order&#039;] = $this-&gt;config-&gt;get(&#039;shipping_my_shipping_sort_order&#039;);\n        }\n\n        $data&#091;&#039;header&#039;] = $this-&gt;load-&gt;controller(&#039;common\/header&#039;);\n        $data&#091;&#039;column_left&#039;] = $this-&gt;load-&gt;controller(&#039;common\/column_left&#039;);\n        $data&#091;&#039;footer&#039;] = $this-&gt;load-&gt;controller(&#039;common\/footer&#039;);\n\n        $this-&gt;response-&gt;setOutput($this-&gt;load-&gt;view(&#039;extension\/shipping\/my_shipping&#039;, $data));\n    }\n\n    protected function validate()\n    {\n        if (!$this-&gt;user-&gt;hasPermission(&#039;modify&#039;, &#039;extension\/shipping\/my_shipping&#039;)) {\n            $this-&gt;error&#091;&#039;warning&#039;] = $this-&gt;language-&gt;get(&#039;error_permission&#039;);\n        }\n\n        return !$this-&gt;error;\n    }\n}<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Create A View File For The Shipping Method <\/strong><\/h2>\n\n\n\n<p>In Order To Proceed, you will need to create a new PHP Twig file. As a consequence, you can create a file called &#8220;my_shipping.php&#8221; in the &#8220;\/admin\/view\/template\/extension\/shipping\/&#8221; directory.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">{#\n * Webkul Software\n * \n * @category Webkul\n * @package Opencart Module Tutorial\n * @author &#091;Webkul] &lt;&#091;&lt;http:\/\/webkul.com\/&gt;]&gt;\n * @copyright Copyright (c) Webkul Software Private Limited (https:\/\/webkul.com)\n * @license https:\/\/store.webkul.com\/license.html\n#}\n{{ header }}{{ column_left }}\n&lt;div id=&quot;content&quot;&gt;\n  &lt;div class=&quot;page-header&quot;&gt;\n    &lt;div class=&quot;container-fluid&quot;&gt;\n      &lt;div class=&quot;pull-right&quot;&gt;\n        &lt;button type=&quot;submit&quot; form=&quot;form-shipping&quot; data-toggle=&quot;tooltip&quot; title=&quot;{{ button_save }}&quot; class=&quot;btn btn-primary&quot;&gt;&lt;i class=&quot;fa fa-save&quot;&gt;&lt;\/i&gt;&lt;\/button&gt;\n        &lt;a href=&quot;{{ cancel }}&quot; data-toggle=&quot;tooltip&quot; title=&quot;{{ button_cancel }}&quot; class=&quot;btn btn-default&quot;&gt;&lt;i class=&quot;fa fa-reply&quot;&gt;&lt;\/i&gt;&lt;\/a&gt;&lt;\/div&gt;\n      &lt;h1&gt;{{ heading_title }}&lt;\/h1&gt;\n      &lt;ul class=&quot;breadcrumb&quot;&gt;\n        {% for breadcrumb in breadcrumbs %}\n        &lt;li&gt;&lt;a href=&quot;{{ breadcrumb.href }}&quot;&gt;{{ breadcrumb.text }}&lt;\/a&gt;&lt;\/li&gt;\n        {% endfor %}\n      &lt;\/ul&gt;\n    &lt;\/div&gt;\n  &lt;\/div&gt;\n  &lt;div class=&quot;container-fluid&quot;&gt;\n    {% if error_warning %}\n    &lt;div class=&quot;alert alert-danger alert-dismissible&quot;&gt;&lt;i class=&quot;fa fa-exclamation-circle&quot;&gt;&lt;\/i&gt; {{ error_warning }}\n      &lt;button type=&quot;button&quot; class=&quot;close&quot; data-dismiss=&quot;alert&quot;&gt;&amp;times;&lt;\/button&gt;\n    &lt;\/div&gt;\n    {% endif %}\n    &lt;div class=&quot;panel panel-default&quot;&gt;\n      &lt;div class=&quot;panel-heading&quot;&gt;\n        &lt;h3 class=&quot;panel-title&quot;&gt;&lt;i class=&quot;fa fa-pencil&quot;&gt;&lt;\/i&gt; {{ text_edit }}&lt;\/h3&gt;\n      &lt;\/div&gt;\n      &lt;div class=&quot;panel-body&quot;&gt;\n        &lt;form action=&quot;{{ action }}&quot; method=&quot;post&quot; enctype=&quot;multipart\/form-data&quot; id=&quot;form-shipping&quot; class=&quot;form-horizontal&quot;&gt;\n          &lt;div class=&quot;form-group&quot;&gt;\n            &lt;label class=&quot;col-sm-2 control-label&quot; for=&quot;input-cost&quot;&gt;{{ entry_cost }}&lt;\/label&gt;\n            &lt;div class=&quot;col-sm-10&quot;&gt;\n              &lt;input type=&quot;text&quot; name=&quot;shipping_my_shipping_cost&quot; value=&quot;{{ shipping_my_shipping_cost }}&quot; placeholder=&quot;{{ entry_cost }}&quot; id=&quot;input-cost&quot; class=&quot;form-control&quot; \/&gt;\n            &lt;\/div&gt;\n          &lt;\/div&gt;\n          &lt;div class=&quot;form-group&quot;&gt;\n            &lt;label class=&quot;col-sm-2 control-label&quot; for=&quot;input-tax-class&quot;&gt;{{ entry_tax_class }}&lt;\/label&gt;\n            &lt;div class=&quot;col-sm-10&quot;&gt;\n              &lt;select name=&quot;shipping_my_shipping_tax_class_id&quot; id=&quot;input-tax-class&quot; class=&quot;form-control&quot;&gt;\n                &lt;option value=&quot;0&quot;&gt;{{ text_none }}&lt;\/option&gt;\n                {% for tax_class in tax_classes %}\n                {% if tax_class.tax_class_id == shipping_my_shipping_tax_class_id %}\n                &lt;option value=&quot;{{ tax_class.tax_class_id }}&quot; selected=&quot;selected&quot;&gt;{{ tax_class.title }}&lt;\/option&gt;\n                {% else %}\n                &lt;option value=&quot;{{ tax_class.tax_class_id }}&quot;&gt;{{ tax_class.title }}&lt;\/option&gt;\n                {% endif %}\n                {% endfor %}\n              &lt;\/select&gt;\n            &lt;\/div&gt;\n          &lt;\/div&gt; \n          &lt;div class=&quot;form-group&quot;&gt;\n            &lt;label class=&quot;col-sm-2 control-label&quot; for=&quot;input-status&quot;&gt;{{ entry_status }}&lt;\/label&gt;\n            &lt;div class=&quot;col-sm-10&quot;&gt;\n              &lt;select name=&quot;shipping_my_shipping_status&quot; id=&quot;input-status&quot; class=&quot;form-control&quot;&gt;\n                {% if shipping_my_shipping_status %}\n                &lt;option value=&quot;1&quot; selected=&quot;selected&quot;&gt;{{ text_enabled }}&lt;\/option&gt;\n                &lt;option value=&quot;0&quot;&gt;{{ text_disabled }}&lt;\/option&gt;\n                {% else %}\n                &lt;option value=&quot;1&quot;&gt;{{ text_enabled }}&lt;\/option&gt;\n                &lt;option value=&quot;0&quot; selected=&quot;selected&quot;&gt;{{ text_disabled }}&lt;\/option&gt;\n                {% endif %}\n              &lt;\/select&gt;\n            &lt;\/div&gt;\n          &lt;\/div&gt;\n          &lt;div class=&quot;form-group&quot;&gt;\n            &lt;label class=&quot;col-sm-2 control-label&quot; for=&quot;input-sort-order&quot;&gt;{{ entry_sort_order }}&lt;\/label&gt;\n            &lt;div class=&quot;col-sm-10&quot;&gt;\n              &lt;input type=&quot;text&quot; name=&quot;shipping_my_shipping_sort_order&quot; value=&quot;{{ shipping_my_shipping_sort_order }}&quot; placeholder=&quot;{{ entry_sort_order }}&quot; id=&quot;input-sort-order&quot; class=&quot;form-control&quot; \/&gt;\n            &lt;\/div&gt;\n          &lt;\/div&gt;\n        &lt;\/form&gt;\n      &lt;\/div&gt;\n    &lt;\/div&gt;\n  &lt;\/div&gt;\n&lt;\/div&gt;\n{{ footer }}<\/pre>\n\n\n\n<p>So, we have completed building our simple&nbsp;shipping module. now, we will&nbsp;install the shipping by heading to <strong>Extensions-&gt; Extensions-&gt; Shipping-&gt; My Shipping<\/strong>&nbsp;from the admin panel, and after installing you can configure the shipping by enabling it.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-style-default\"><img decoding=\"async\" width=\"1200\" height=\"609\" src=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/04\/Selection_1414-1200x609.png\" alt=\"Installed the New Shipping Method\" class=\"wp-image-376933\" srcset=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/04\/Selection_1414-1200x609.png 1200w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/04\/Selection_1414-300x152.png 300w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/04\/Selection_1414-250x127.png 250w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/04\/Selection_1414-768x390.png 768w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/04\/Selection_1414.png 1513w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" loading=\"lazy\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"configuration\"><strong>Configuration<\/strong><\/h2>\n\n\n\n<p>Therefore, the admin can easily set the module as per the business requirement by navigating via &#8220;<strong>Extensions-&gt; Extensions-&gt; Shipping-&gt; My Shipping<\/strong>&#8220;.<\/p>\n\n\n\n<p>Once you have installed the My Shipping Module, you can then edit the module and add the Shipping Cost.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1200\" height=\"605\" src=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/04\/Selection_1431-1200x605.png\" alt=\"My Shipping module configuration\" class=\"wp-image-377396\" srcset=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/04\/Selection_1431-1200x605.png 1200w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/04\/Selection_1431-300x151.png 300w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/04\/Selection_1431-250x126.png 250w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/04\/Selection_1431-768x387.png 768w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/04\/Selection_1431.png 1525w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" loading=\"lazy\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Cost<\/strong>&nbsp;\u2013 Furthermore, the admin is required to set the cost for this Shipping method.<\/li>\n\n\n\n<li><strong>Tax Class<\/strong>: Tax classes are used in case you want to put any kind of tax on your shipping.<\/li>\n\n\n\n<li><strong>Status<\/strong>\u2013 Moreover, the admin only needs to enable or disable the module as per the requirement in the Status section.<\/li>\n\n\n\n<li><strong>Sort Order<\/strong>: Order at which the My Shipping will come among other shipping methods or shipping modules.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Create A Language File For The Front End<\/strong><\/h2>\n\n\n\n<p>In order To Proceed, you will need to create a new Language file. Consequently, you can create a file called &#8220;my_shipping.php&#8221; in the &#8220;\/catalog\/language\/en-gb\/extension\/shipping\/&#8221; directory.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">&lt;?php\n\/**\n * Webkul Software\n * \n * @category Webkul\n * @package Opencart Module Tutorial\n * @author &#091;Webkul] &lt;&#091;&lt;http:\/\/webkul.com\/&gt;]&gt;\n * @copyright Copyright (c) Webkul Software Private Limited (https:\/\/webkul.com)\n * @license https:\/\/store.webkul.com\/license.html\n *\/\n\/\/ Text\n$_&#091;&#039;text_title&#039;]       = &#039;My Shipping Rate&#039;;\n$_&#091;&#039;text_description&#039;] = &#039;My Shipping Rate&#039;;<\/pre>\n\n\n\n<p>Having completed the previous step, we will now proceed to the model file of the shipping, which is the most important file as all the calculations are conducted in this file itself.<\/p>\n\n\n\n<p>Now we need to create a file for the Front end so the Customer can interact with our module.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Create A Model File For The Front End<\/strong><\/h2>\n\n\n\n<p>You will need to create a new PHP file for your module, Consequently, you can create a file called &#8220;my_shipping.php&#8221; in the&#8221;<strong>\/catalog\/model\/extension\/shipping\/<\/strong>&#8221; directory.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">&lt;?php\n\/**\n * Webkul Software\n * \n * @category Webkul\n * @package Opencart Module Tutorial\n * @author &#091;Webkul] &lt;&#091;&lt;http:\/\/webkul.com\/&gt;]&gt;\n * @copyright Copyright (c) Webkul Software Private Limited (https:\/\/webkul.com)\n * @license https:\/\/store.webkul.com\/license.html\n *\/\nclass ModelExtensionShippingMyShipping extends Model\n{\n    public function getQuote($address)\n    {\n        $this-&gt;load-&gt;language(&#039;extension\/shipping\/my_shipping&#039;);\n\n        $method_data = array();\n        $quote_data = array();\n\n        $quote_data&#091;&#039;my_shipping&#039;] = array(\n            &#039;code&#039; =&gt; &#039;my_shipping.my_shipping&#039;,\n            &#039;title&#039; =&gt; $this-&gt;language-&gt;get(&#039;text_description&#039;),\n            &#039;cost&#039; =&gt; $this-&gt;config-&gt;get(&#039;shipping_my_shipping_cost&#039;),\n            &#039;tax_class_id&#039; =&gt; $this-&gt;config-&gt;get(&#039;shipping_my_shipping_tax_class_id&#039;),\n            &#039;text&#039; =&gt; $this-&gt;currency-&gt;format($this-&gt;tax-&gt;calculate($this-&gt;config-&gt;get(&#039;shipping_my_shipping_cost&#039;), $this-&gt;config-&gt;get(&#039;shipping_my_shipping_tax_class_id&#039;), $this-&gt;config-&gt;get(&#039;config_tax&#039;)), $this-&gt;session-&gt;data&#091;&#039;currency&#039;])\n        );\n\n        $method_data = array(\n            &#039;code&#039; =&gt; &#039;my_shipping&#039;,\n            &#039;title&#039; =&gt; $this-&gt;language-&gt;get(&#039;text_title&#039;),\n            &#039;quote&#039; =&gt; $quote_data,\n            &#039;sort_order&#039; =&gt; $this-&gt;config-&gt;get(&#039;shipping_my_shipping_sort_order&#039;),\n            &#039;error&#039; =&gt; false\n        );\n        return $method_data;\n    }\n}<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Front End For Buyers At The Checkout Page<\/strong><\/h2>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1200\" height=\"595\" src=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/04\/Selection_1412-1200x595.png\" alt=\"Shipping Method working at the Front End\" class=\"wp-image-376928\" srcset=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/04\/Selection_1412-1200x595.png 1200w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/04\/Selection_1412-300x149.png 300w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/04\/Selection_1412-250x124.png 250w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/04\/Selection_1412-768x381.png 768w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/04\/Selection_1412.png 1515w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" loading=\"lazy\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1200\" height=\"720\" src=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/04\/Selection_1429-1200x720.png\" alt=\"Shipping Method working at the Front End\" class=\"wp-image-377334\" srcset=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/04\/Selection_1429-1200x720.png 1200w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/04\/Selection_1429-300x180.png 300w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/04\/Selection_1429-250x150.png 250w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/04\/Selection_1429-768x461.png 768w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/04\/Selection_1429.png 1250w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" loading=\"lazy\" \/><\/figure>\n\n\n\n<p>That is all for you&nbsp;<strong>How to create a simple shipping method in the Opencart<\/strong>. <\/p>\n\n\n\n<p>If you need custom\u00a0<a href=\"https:\/\/webkul.com\/opencart-development\/\" target=\"_blank\" rel=\"noreferrer noopener\">Opencart Development services<\/a>\u00a0then feel free to\u00a0reach us. And also explore our exclusive range of\u00a0<a href=\"https:\/\/store.webkul.com\/OpenCart-Modules.html\" target=\"_blank\" rel=\"noreferrer noopener\">Opencart Modules<\/a>.<br>!!Have a Great Day Ahead!!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In our previous blog, we learned to create a module in Opencart. Now, we learn to build a simple module in Opencart. Shipping is one of the major parts of an e-commerce website. So, we must learn this part&nbsp;for the Opencart. Create A Language File For The Shipping Method In Order To Proceed, you will <a href=\"https:\/\/webkul.com\/blog\/how-to-create-a-simple-shipping-method-in-opencart\/\">[&#8230;]<\/a><\/p>\n","protected":false},"author":528,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[305],"tags":[8110],"class_list":["post-376751","post","type-post","status-publish","format-standard","hentry","category-opencart","tag-opencart-shipping-module"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to create Simple Shipping Method in Opencart - Webkul Blog<\/title>\n<meta name=\"description\" content=\"In this blog post, we will walk you through the steps to create a Shipping Method in Opencart, including the folder structure and code.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/webkul.com\/blog\/how-to-create-a-simple-shipping-method-in-opencart\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to create Simple Shipping Method in Opencart - Webkul Blog\" \/>\n<meta property=\"og:description\" content=\"In this blog post, we will walk you through the steps to create a Shipping Method in Opencart, including the folder structure and code.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/webkul.com\/blog\/how-to-create-a-simple-shipping-method-in-opencart\/\" \/>\n<meta property=\"og:site_name\" content=\"Webkul Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/webkul\/\" \/>\n<meta property=\"article:published_time\" content=\"2023-04-14T10:03:03+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-04-20T06:48:15+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2023\/04\/Selection_1414-1200x609.png\" \/>\n<meta name=\"author\" content=\"Ganesh Pandey\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@webkul\" \/>\n<meta name=\"twitter:site\" content=\"@webkul\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Ganesh Pandey\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/webkul.com\/blog\/how-to-create-a-simple-shipping-method-in-opencart\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/webkul.com\/blog\/how-to-create-a-simple-shipping-method-in-opencart\/\"},\"author\":{\"name\":\"Ganesh Pandey\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/458e25f8fd3e923c5a21d2b22e1c2d65\"},\"headline\":\"How to Create a Simple Shipping Method in Opencart?\",\"datePublished\":\"2023-04-14T10:03:03+00:00\",\"dateModified\":\"2023-04-20T06:48:15+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/webkul.com\/blog\/how-to-create-a-simple-shipping-method-in-opencart\/\"},\"wordCount\":514,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/webkul.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/how-to-create-a-simple-shipping-method-in-opencart\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2023\/04\/Selection_1414-1200x609.png\",\"keywords\":[\"Opencart Shipping module\"],\"articleSection\":[\"opencart\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/webkul.com\/blog\/how-to-create-a-simple-shipping-method-in-opencart\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/webkul.com\/blog\/how-to-create-a-simple-shipping-method-in-opencart\/\",\"url\":\"https:\/\/webkul.com\/blog\/how-to-create-a-simple-shipping-method-in-opencart\/\",\"name\":\"How to create Simple Shipping Method in Opencart - Webkul Blog\",\"isPartOf\":{\"@id\":\"https:\/\/webkul.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/webkul.com\/blog\/how-to-create-a-simple-shipping-method-in-opencart\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/how-to-create-a-simple-shipping-method-in-opencart\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2023\/04\/Selection_1414-1200x609.png\",\"datePublished\":\"2023-04-14T10:03:03+00:00\",\"dateModified\":\"2023-04-20T06:48:15+00:00\",\"description\":\"In this blog post, we will walk you through the steps to create a Shipping Method in Opencart, including the folder structure and code.\",\"breadcrumb\":{\"@id\":\"https:\/\/webkul.com\/blog\/how-to-create-a-simple-shipping-method-in-opencart\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/webkul.com\/blog\/how-to-create-a-simple-shipping-method-in-opencart\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/how-to-create-a-simple-shipping-method-in-opencart\/#primaryimage\",\"url\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/04\/Selection_1414.png\",\"contentUrl\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/04\/Selection_1414.png\",\"width\":1513,\"height\":768,\"caption\":\"Selection_1414\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/webkul.com\/blog\/how-to-create-a-simple-shipping-method-in-opencart\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/webkul.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Create a Simple Shipping Method in Opencart?\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/webkul.com\/blog\/#website\",\"url\":\"https:\/\/webkul.com\/blog\/\",\"name\":\"Webkul Blog\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/webkul.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/webkul.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/webkul.com\/blog\/#organization\",\"name\":\"WebKul Software Private Limited\",\"url\":\"https:\/\/webkul.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png\",\"contentUrl\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png\",\"width\":380,\"height\":380,\"caption\":\"WebKul Software Private Limited\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/webkul\/\",\"https:\/\/x.com\/webkul\",\"https:\/\/www.instagram.com\/webkul\/\",\"https:\/\/www.linkedin.com\/company\/webkul\",\"https:\/\/www.youtube.com\/user\/webkul\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/458e25f8fd3e923c5a21d2b22e1c2d65\",\"name\":\"Ganesh Pandey\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/152ad7f326176dae5bae010122170759eb73af406fd971e3d089417a3dc72e19?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/152ad7f326176dae5bae010122170759eb73af406fd971e3d089417a3dc72e19?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g\",\"caption\":\"Ganesh Pandey\"},\"url\":\"https:\/\/webkul.com\/blog\/author\/ganeshpandey-oc\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to create Simple Shipping Method in Opencart - Webkul Blog","description":"In this blog post, we will walk you through the steps to create a Shipping Method in Opencart, including the folder structure and code.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/webkul.com\/blog\/how-to-create-a-simple-shipping-method-in-opencart\/","og_locale":"en_US","og_type":"article","og_title":"How to create Simple Shipping Method in Opencart - Webkul Blog","og_description":"In this blog post, we will walk you through the steps to create a Shipping Method in Opencart, including the folder structure and code.","og_url":"https:\/\/webkul.com\/blog\/how-to-create-a-simple-shipping-method-in-opencart\/","og_site_name":"Webkul Blog","article_publisher":"https:\/\/www.facebook.com\/webkul\/","article_published_time":"2023-04-14T10:03:03+00:00","article_modified_time":"2023-04-20T06:48:15+00:00","og_image":[{"url":"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2023\/04\/Selection_1414-1200x609.png","type":"","width":"","height":""}],"author":"Ganesh Pandey","twitter_card":"summary_large_image","twitter_creator":"@webkul","twitter_site":"@webkul","twitter_misc":{"Written by":"Ganesh Pandey","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/webkul.com\/blog\/how-to-create-a-simple-shipping-method-in-opencart\/#article","isPartOf":{"@id":"https:\/\/webkul.com\/blog\/how-to-create-a-simple-shipping-method-in-opencart\/"},"author":{"name":"Ganesh Pandey","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/458e25f8fd3e923c5a21d2b22e1c2d65"},"headline":"How to Create a Simple Shipping Method in Opencart?","datePublished":"2023-04-14T10:03:03+00:00","dateModified":"2023-04-20T06:48:15+00:00","mainEntityOfPage":{"@id":"https:\/\/webkul.com\/blog\/how-to-create-a-simple-shipping-method-in-opencart\/"},"wordCount":514,"commentCount":0,"publisher":{"@id":"https:\/\/webkul.com\/blog\/#organization"},"image":{"@id":"https:\/\/webkul.com\/blog\/how-to-create-a-simple-shipping-method-in-opencart\/#primaryimage"},"thumbnailUrl":"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2023\/04\/Selection_1414-1200x609.png","keywords":["Opencart Shipping module"],"articleSection":["opencart"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/webkul.com\/blog\/how-to-create-a-simple-shipping-method-in-opencart\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/webkul.com\/blog\/how-to-create-a-simple-shipping-method-in-opencart\/","url":"https:\/\/webkul.com\/blog\/how-to-create-a-simple-shipping-method-in-opencart\/","name":"How to create Simple Shipping Method in Opencart - Webkul Blog","isPartOf":{"@id":"https:\/\/webkul.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/webkul.com\/blog\/how-to-create-a-simple-shipping-method-in-opencart\/#primaryimage"},"image":{"@id":"https:\/\/webkul.com\/blog\/how-to-create-a-simple-shipping-method-in-opencart\/#primaryimage"},"thumbnailUrl":"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2023\/04\/Selection_1414-1200x609.png","datePublished":"2023-04-14T10:03:03+00:00","dateModified":"2023-04-20T06:48:15+00:00","description":"In this blog post, we will walk you through the steps to create a Shipping Method in Opencart, including the folder structure and code.","breadcrumb":{"@id":"https:\/\/webkul.com\/blog\/how-to-create-a-simple-shipping-method-in-opencart\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/webkul.com\/blog\/how-to-create-a-simple-shipping-method-in-opencart\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/how-to-create-a-simple-shipping-method-in-opencart\/#primaryimage","url":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/04\/Selection_1414.png","contentUrl":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/04\/Selection_1414.png","width":1513,"height":768,"caption":"Selection_1414"},{"@type":"BreadcrumbList","@id":"https:\/\/webkul.com\/blog\/how-to-create-a-simple-shipping-method-in-opencart\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/webkul.com\/blog\/"},{"@type":"ListItem","position":2,"name":"How to Create a Simple Shipping Method in Opencart?"}]},{"@type":"WebSite","@id":"https:\/\/webkul.com\/blog\/#website","url":"https:\/\/webkul.com\/blog\/","name":"Webkul Blog","description":"","publisher":{"@id":"https:\/\/webkul.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/webkul.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/webkul.com\/blog\/#organization","name":"WebKul Software Private Limited","url":"https:\/\/webkul.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png","contentUrl":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png","width":380,"height":380,"caption":"WebKul Software Private Limited"},"image":{"@id":"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/webkul\/","https:\/\/x.com\/webkul","https:\/\/www.instagram.com\/webkul\/","https:\/\/www.linkedin.com\/company\/webkul","https:\/\/www.youtube.com\/user\/webkul\/"]},{"@type":"Person","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/458e25f8fd3e923c5a21d2b22e1c2d65","name":"Ganesh Pandey","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/152ad7f326176dae5bae010122170759eb73af406fd971e3d089417a3dc72e19?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/152ad7f326176dae5bae010122170759eb73af406fd971e3d089417a3dc72e19?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g","caption":"Ganesh Pandey"},"url":"https:\/\/webkul.com\/blog\/author\/ganeshpandey-oc\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/376751","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/users\/528"}],"replies":[{"embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/comments?post=376751"}],"version-history":[{"count":58,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/376751\/revisions"}],"predecessor-version":[{"id":377467,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/376751\/revisions\/377467"}],"wp:attachment":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/media?parent=376751"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/categories?post=376751"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/tags?post=376751"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}