{"id":73644,"date":"2017-02-03T16:15:17","date_gmt":"2017-02-03T16:15:17","guid":{"rendered":"https:\/\/webkul.com\/blog\/?p=73644"},"modified":"2023-07-26T06:12:19","modified_gmt":"2023-07-26T06:12:19","slug":"use-shipping-api-opencart","status":"publish","type":"post","link":"https:\/\/webkul.com\/blog\/use-shipping-api-opencart\/","title":{"rendered":"How To Use Shipping Api In Opencart"},"content":{"rendered":"<p>Today we will learn, how to use shipping API in an open cart and where the open cart uses this shipping API.<\/p>\n<p>Opencart uses the shipping API in the shipping details section while adding or editing the order from the admin end. After adding the payment details from the sales-&gt;orders when we click the continue button, then it goes to the shipping details section.<\/p>\n<p><img decoding=\"async\" class=\"aligncenter wp-image-73646 size-full\" src=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/02\/shipping.png\" alt=\"Images\" width=\"1292\" height=\"671\" srcset=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/02\/shipping.png 1292w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/02\/shipping-250x130.png 250w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/02\/shipping-300x156.png 300w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/02\/shipping-768x399.png 768w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/02\/shipping-1200x623.png 1200w\" sizes=\"(max-width: 1292px) 100vw, 1292px\" loading=\"lazy\" \/><\/p>\n<p>After selecting or adding the shipping address from the shipping details section when we click the continue button. Two methods of payment API will be called: address and methods.<\/p>\n<p>The address method is used to set the shipping address of the order.<\/p>\n<p>The method validates the address values and if all values are following the norms then, it sets the address values into the session. The code of the address method is given below :<\/p>\n<pre class=\"brush:php\">\/**\n * Webkul Software.\n *\n * @category Webkul\n * @package api\n * @author Webkul\n * @copyright Copyright (c) Webkul Software Private Limited (https:\/\/webkul.com)\n * @license https:\/\/store.webkul.com\/license.html\n *\/\n\npublic function address() {\n\t$this-&gt;load-&gt;language('api\/shipping');\n\n\t\/\/ Delete old shipping address, shipping methods and method so not to cause any issues if there is an error\n\tunset($this-&gt;session-&gt;data['shipping_address']);\n\tunset($this-&gt;session-&gt;data['shipping_methods']);\n\tunset($this-&gt;session-&gt;data['shipping_method']);\n\n\t$json = array();\n\n\tif ($this-&gt;cart-&gt;hasShipping()) {\n\t\t\/\/ Check for api login\n\t\tif (!isset($this-&gt;session-&gt;data['api_id'])) {\n\t\t\t$json['error']['warning'] = $this-&gt;language-&gt;get('error_permission');\n\t\t} else {\n\t\t\t\/\/ Add keys for missing post vars\n\t\t\t$keys = array(\n\t\t\t\t'firstname',\n\t\t\t\t'lastname',\n\t\t\t\t'company',\n\t\t\t\t'address_1',\n\t\t\t\t'address_2',\n\t\t\t\t'postcode',\n\t\t\t\t'city',\n\t\t\t\t'zone_id',\n\t\t\t\t'country_id'\n\t\t\t);\n\n\t\t\tforeach ($keys as $key) {\n\t\t\t\tif (!isset($this-&gt;request-&gt;post[$key])) {\n\t\t\t\t\t$this-&gt;request-&gt;post[$key] = '';\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t\/\/ Shipping address fields validation\n\t\t\tif ((utf8_strlen(trim($this-&gt;request-&gt;post['firstname'])) &lt; 1) || (utf8_strlen(trim($this-&gt;request-&gt;post['firstname'])) &gt; 32)) {\n\t\t\t\t$json['error']['firstname'] = $this-&gt;language-&gt;get('error_firstname');\n\t\t\t}\n\n\t\t\tif ((utf8_strlen(trim($this-&gt;request-&gt;post['lastname'])) &lt; 1) || (utf8_strlen(trim($this-&gt;request-&gt;post['lastname'])) &gt; 32)) {\n\t\t\t\t$json['error']['lastname'] = $this-&gt;language-&gt;get('error_lastname');\n\t\t\t}\n\n\t\t\tif ((utf8_strlen(trim($this-&gt;request-&gt;post['address_1'])) &lt; 3) || (utf8_strlen(trim($this-&gt;request-&gt;post['address_1'])) &gt; 128)) {\n\t\t\t\t$json['error']['address_1'] = $this-&gt;language-&gt;get('error_address_1');\n\t\t\t}\n\n\t\t\tif ((utf8_strlen($this-&gt;request-&gt;post['city']) &lt; 2) || (utf8_strlen($this-&gt;request-&gt;post['city']) &gt; 32)) {\n\t\t\t\t$json['error']['city'] = $this-&gt;language-&gt;get('error_city');\n\t\t\t}\n\n\t\t\t$this-&gt;load-&gt;model('localisation\/country');\n\n\t\t\t$country_info = $this-&gt;model_localisation_country-&gt;getCountry($this-&gt;request-&gt;post['country_id']);\n\n\t\t\tif ($country_info &amp;&amp; $country_info['postcode_required'] &amp;&amp; (utf8_strlen(trim($this-&gt;request-&gt;post['postcode'])) &lt; 2 || utf8_strlen(trim($this-&gt;request-&gt;post['postcode'])) &gt; 10)) {\n\t\t\t\t$json['error']['postcode'] = $this-&gt;language-&gt;get('error_postcode');\n\t\t\t}\n\n\t\t\tif ($this-&gt;request-&gt;post['country_id'] == '') {\n\t\t\t\t$json['error']['country'] = $this-&gt;language-&gt;get('error_country');\n\t\t\t}\n\n\t\t\tif (!isset($this-&gt;request-&gt;post['zone_id']) || $this-&gt;request-&gt;post['zone_id'] == '') {\n\t\t\t\t$json['error']['zone'] = $this-&gt;language-&gt;get('error_zone');\n\t\t\t}\n\n\t\t\t\/\/ Custom field validation\n\t\t\t$this-&gt;load-&gt;model('account\/custom_field');\n\n\t\t\t$custom_fields = $this-&gt;model_account_custom_field-&gt;getCustomFields($this-&gt;config-&gt;get('config_customer_group_id'));\n\n\t\t\tforeach ($custom_fields as $custom_field) {\n\t\t\t\tif (($custom_field['location'] == 'address') &amp;&amp; $custom_field['required'] &amp;&amp; empty($this-&gt;request-&gt;post['custom_field'][$custom_field['custom_field_id']])) {\n\t\t\t\t\t$json['error']['custom_field' . $custom_field['custom_field_id']] = sprintf($this-&gt;language-&gt;get('error_custom_field'), $custom_field['name']);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (!$json) {\n\t\t\t\t$this-&gt;load-&gt;model('localisation\/country');\n\n\t\t\t\t$country_info = $this-&gt;model_localisation_country-&gt;getCountry($this-&gt;request-&gt;post['country_id']);\n\n\t\t\t\tif ($country_info) {\n\t\t\t\t\t$country = $country_info['name'];\n\t\t\t\t\t$iso_code_2 = $country_info['iso_code_2'];\n\t\t\t\t\t$iso_code_3 = $country_info['iso_code_3'];\n\t\t\t\t\t$address_format = $country_info['address_format'];\n\t\t\t\t} else {\n\t\t\t\t\t$country = '';\n\t\t\t\t\t$iso_code_2 = '';\n\t\t\t\t\t$iso_code_3 = '';\n\t\t\t\t\t$address_format = '';\n\t\t\t\t}\n\n\t\t\t\t$this-&gt;load-&gt;model('localisation\/zone');\n\n\t\t\t\t$zone_info = $this-&gt;model_localisation_zone-&gt;getZone($this-&gt;request-&gt;post['zone_id']);\n\n\t\t\t\tif ($zone_info) {\n\t\t\t\t\t$zone = $zone_info['name'];\n\t\t\t\t\t$zone_code = $zone_info['code'];\n\t\t\t\t} else {\n\t\t\t\t\t$zone = '';\n\t\t\t\t\t$zone_code = '';\n\t\t\t\t}\n\t\t\t\t\/\/If all fields are valid then set the shipping address in the session\n\t\t\t\t$this-&gt;session-&gt;data['shipping_address'] = array(\n\t\t\t\t\t'firstname'      =&gt; $this-&gt;request-&gt;post['firstname'],\n\t\t\t\t\t'lastname'       =&gt; $this-&gt;request-&gt;post['lastname'],\n\t\t\t\t\t'company'        =&gt; $this-&gt;request-&gt;post['company'],\n\t\t\t\t\t'address_1'      =&gt; $this-&gt;request-&gt;post['address_1'],\n\t\t\t\t\t'address_2'      =&gt; $this-&gt;request-&gt;post['address_2'],\n\t\t\t\t\t'postcode'       =&gt; $this-&gt;request-&gt;post['postcode'],\n\t\t\t\t\t'city'           =&gt; $this-&gt;request-&gt;post['city'],\n\t\t\t\t\t'zone_id'        =&gt; $this-&gt;request-&gt;post['zone_id'],\n\t\t\t\t\t'zone'           =&gt; $zone,\n\t\t\t\t\t'zone_code'      =&gt; $zone_code,\n\t\t\t\t\t'country_id'     =&gt; $this-&gt;request-&gt;post['country_id'],\n\t\t\t\t\t'country'        =&gt; $country,\n\t\t\t\t\t'iso_code_2'     =&gt; $iso_code_2,\n\t\t\t\t\t'iso_code_3'     =&gt; $iso_code_3,\n\t\t\t\t\t'address_format' =&gt; $address_format,\n\t\t\t\t\t'custom_field'   =&gt; isset($this-&gt;request-&gt;post['custom_field']) ? $this-&gt;request-&gt;post['custom_field'] : array()\n\t\t\t\t);\n\n\t\t\t\t$json['success'] = $this-&gt;language-&gt;get('text_address');\n\n\t\t\t\tunset($this-&gt;session-&gt;data['shipping_method']);\n\t\t\t\tunset($this-&gt;session-&gt;data['shipping_methods']);\n\t\t\t}\n\t\t}\n\t}\n\n\t$this-&gt;response-&gt;addHeader('Content-Type: application\/json');\n\t\n\t$this-&gt;response-&gt;setOutput(json_encode($json));\n}<\/pre>\n<p>If an address is successfully saved in the session then, it returns the success message as the response.<\/p>\n<p><img decoding=\"async\" class=\"aligncenter wp-image-73648 size-full\" src=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/02\/address.png\" alt=\"Images\" width=\"453\" height=\"46\" srcset=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/02\/address.png 453w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/02\/address-250x25.png 250w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/02\/address-300x30.png 300w\" sizes=\"(max-width: 453px) 100vw, 453px\" loading=\"lazy\" \/><\/p>\n<p>The second method is &#8220;methods&#8221;. The method is used to get the list of shipping methods that can be applied to a particular order based on the shipping address. The code of the method is given below:<\/p>\n<pre class=\"brush:php\">\/**\n * Webkul Software.\n *\n * @category Webkul\n * @package api\n * @author Webkul\n * @copyright Copyright (c) Webkul Software Private Limited (https:\/\/webkul.com)\n * @license https:\/\/store.webkul.com\/license.html\n *\/\n\npublic function methods() {\n\t$this-&gt;load-&gt;language('api\/shipping');\n\n\t\/\/ Delete past shipping methods and method just in case there is an error\n\tunset($this-&gt;session-&gt;data['shipping_methods']);\n\tunset($this-&gt;session-&gt;data['shipping_method']);\n\n\t$json = array();\n\n\t\/\/Check for api login\n\tif (!isset($this-&gt;session-&gt;data['api_id'])) {\n\t\t$json['error'] = $this-&gt;language-&gt;get('error_permission');\n\t} elseif ($this-&gt;cart-&gt;hasShipping()) {\n\t\tif (!isset($this-&gt;session-&gt;data['shipping_address'])) {\n\t\t\t$json['error'] = $this-&gt;language-&gt;get('error_address');\n\t\t}\n\n\t\tif (!$json) {\n\t\t\t\/\/ Shipping Methods\n\t\t\t$json['shipping_methods'] = array();\n\n\t\t\t$this-&gt;load-&gt;model('extension\/extension');\n\n\t\t\t\/\/Get the shipping methods\n\t\t\t$results = $this-&gt;model_extension_extension-&gt;getExtensions('shipping');\n\n\t\t\tforeach ($results as $result) {\n\t\t\t\tif ($this-&gt;config-&gt;get($result['code'] . '_status')) {\n\t\t\t\t\t$this-&gt;load-&gt;model('shipping\/' . $result['code']);\n\n\t\t\t\t\t$quote = $this-&gt;{'model_shipping_' . $result['code']}-&gt;getQuote($this-&gt;session-&gt;data['shipping_address']);\n\n\t\t\t\t\tif ($quote) {\n\t\t\t\t\t\t$json['shipping_methods'][$result['code']] = array(\n\t\t\t\t\t\t\t'title'      =&gt; $quote['title'],\n\t\t\t\t\t\t\t'quote'      =&gt; $quote['quote'],\n\t\t\t\t\t\t\t'sort_order' =&gt; $quote['sort_order'],\n\t\t\t\t\t\t\t'error'      =&gt; $quote['error']\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t$sort_order = array();\n\n\t\t\tforeach ($json['shipping_methods'] as $key =&gt; $value) {\n\t\t\t\t$sort_order[$key] = $value['sort_order'];\n\t\t\t}\n\n\t\t\tarray_multisort($sort_order, SORT_ASC, $json['shipping_methods']);\n\n\t\t\t\/\/Set the shipping methods in the session\n\t\t\tif ($json['shipping_methods']) {\n\t\t\t\t$this-&gt;session-&gt;data['shipping_methods'] = $json['shipping_methods'];\n\t\t\t} else {\n\t\t\t\t$json['error'] = $this-&gt;language-&gt;get('error_no_shipping');\n\t\t\t}\n\t\t}\n\t} else {\n\t\t$json['shipping_methods'] = array();\n\t}\n\n\tif (isset($this-&gt;request-&gt;server['HTTP_ORIGIN'])) {\n\t\t$this-&gt;response-&gt;addHeader('Access-Control-Allow-Origin: ' . $this-&gt;request-&gt;server['HTTP_ORIGIN']);\n\t\t$this-&gt;response-&gt;addHeader('Access-Control-Allow-Methods: GET, PUT, POST, DELETE, OPTIONS');\n\t\t$this-&gt;response-&gt;addHeader('Access-Control-Max-Age: 1000');\n\t\t$this-&gt;response-&gt;addHeader('Access-Control-Allow-Headers: Content-Type, Authorization, X-Requested-With');\n\t}\n\n\t$this-&gt;response-&gt;addHeader('Content-Type: application\/json');\n\t$this-&gt;response-&gt;setOutput(json_encode($json));\n}<\/pre>\n<p>If the method successfully fetches the available shipping methods then it returns the list of available shipping methods.<\/p>\n<p><img decoding=\"async\" class=\"aligncenter wp-image-73650 size-full\" src=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/02\/methods.png\" alt=\"Image\" width=\"809\" height=\"44\" srcset=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/02\/methods.png 809w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/02\/methods-250x14.png 250w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/02\/methods-300x16.png 300w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/02\/methods-768x42.png 768w\" sizes=\"(max-width: 809px) 100vw, 809px\" loading=\"lazy\" \/><\/p>\n<p>In the shipping API, there is one more method named &#8220;method&#8221;.<\/p>\n<p>The method is used to set the shipping method that will be applied to the current order.<\/p>\n<p>Opencart uses this method in the last step of order creation from the admin end as shown below. The method is called when we click the apply button(placed on the right side of the shipping method).<\/p>\n<p><img decoding=\"async\" class=\"aligncenter wp-image-73651 size-full\" src=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/02\/method_apply.png\" alt=\"Image\" width=\"1276\" height=\"627\" srcset=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/02\/method_apply.png 1276w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/02\/method_apply-250x123.png 250w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/02\/method_apply-300x147.png 300w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/02\/method_apply-768x377.png 768w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/02\/method_apply-1200x590.png 1200w\" sizes=\"(max-width: 1276px) 100vw, 1276px\" loading=\"lazy\" \/><\/p>\n<p>The code of the method is given below :<\/p>\n<pre class=\"brush:php\">\/**\n * Webkul Software.\n *\n * @category Webkul\n * @package api\n * @author Webkul\n * @copyright Copyright (c) Webkul Software Private Limited (https:\/\/webkul.com)\n * @license https:\/\/store.webkul.com\/license.html\n *\/\n\npublic function method() {\n\t$this-&gt;load-&gt;language('api\/shipping');\n\n\t\/\/ Delete old shipping method so not to cause any issues if there is an error\n\tunset($this-&gt;session-&gt;data['shipping_method']);\n\n\t$json = array();\n\n\t\/\/Check for api login\n\tif (!isset($this-&gt;session-&gt;data['api_id'])) {\n\t\t$json['error'] = $this-&gt;language-&gt;get('error_permission');\n\t} else {\n\t\tif ($this-&gt;cart-&gt;hasShipping()) {\n\t\t\t\/\/ Shipping Address\n\t\t\tif (!isset($this-&gt;session-&gt;data['shipping_address'])) {\n\t\t\t\t$json['error'] = $this-&gt;language-&gt;get('error_address');\n\t\t\t}\n\n\t\t\t\/\/ Shipping Method\n\t\t\tif (empty($this-&gt;session-&gt;data['shipping_methods'])) {\n\t\t\t\t$json['error'] = $this-&gt;language-&gt;get('error_no_shipping');\n\t\t\t} elseif (!isset($this-&gt;request-&gt;post['shipping_method'])) {\n\t\t\t\t$json['error'] = $this-&gt;language-&gt;get('error_method');\n\t\t\t} else {\n\t\t\t\t$shipping = explode('.', $this-&gt;request-&gt;post['shipping_method']);\n\n\t\t\t\tif (!isset($shipping[0]) || !isset($shipping[1]) || !isset($this-&gt;session-&gt;data['shipping_methods'][$shipping[0]]['quote'][$shipping[1]])) {\n\t\t\t\t\t$json['error'] = $this-&gt;language-&gt;get('error_method');\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t\/\/ If no error then save the shipping method in the session\n\t\t\tif (!$json) {\n\t\t\t\t$this-&gt;session-&gt;data['shipping_method'] = $this-&gt;session-&gt;data['shipping_methods'][$shipping[0]]['quote'][$shipping[1]];\n\n\t\t\t\t$json['success'] = $this-&gt;language-&gt;get('text_method');\n\t\t\t}\n\t\t} else {\n\t\t\tunset($this-&gt;session-&gt;data['shipping_address']);\n\t\t\tunset($this-&gt;session-&gt;data['shipping_method']);\n\t\t\tunset($this-&gt;session-&gt;data['shipping_methods']);\n\t\t}\n\t}\n\n\t$this-&gt;response-&gt;addHeader('Content-Type: application\/json');\n\t\n\t$this-&gt;response-&gt;setOutput(json_encode($json));\n}<\/pre>\n<p>If the shipping method is successfully applied, then it returns the success message as given below :<\/p>\n<p><img decoding=\"async\" class=\"aligncenter wp-image-73652 size-full\" src=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/02\/method.png\" alt=\"Image\" width=\"444\" height=\"36\" srcset=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/02\/method.png 444w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/02\/method-250x20.png 250w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/02\/method-300x24.png 300w\" sizes=\"(max-width: 444px) 100vw, 444px\" loading=\"lazy\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Today we will learn, how to use shipping API in an open cart and where the open cart uses this shipping API. Opencart uses the shipping API in the shipping details section while adding or editing the order from the admin end. After adding the payment details from the sales-&gt;orders when we click the continue <a href=\"https:\/\/webkul.com\/blog\/use-shipping-api-opencart\/\">[&#8230;]<\/a><\/p>\n","protected":false},"author":124,"featured_media":41008,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[305],"tags":[2253],"class_list":["post-73644","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-opencart","tag-rest-api"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How To Use Shipping Api In Opencart - Webkul Blog<\/title>\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\/use-shipping-api-opencart\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How To Use Shipping Api In Opencart - Webkul Blog\" \/>\n<meta property=\"og:description\" content=\"Today we will learn, how to use shipping API in an open cart and where the open cart uses this shipping API. Opencart uses the shipping API in the shipping details section while adding or editing the order from the admin end. After adding the payment details from the sales-&gt;orders when we click the continue [...]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/webkul.com\/blog\/use-shipping-api-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=\"2017-02-03T16:15:17+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-07-26T06:12:19+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/02\/Opencart-Code-Snippet.png\" \/>\n\t<meta property=\"og:image:width\" content=\"825\" \/>\n\t<meta property=\"og:image:height\" content=\"260\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Sarang Agrawal\" \/>\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=\"Sarang Agrawal\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"8 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/webkul.com\/blog\/use-shipping-api-opencart\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/webkul.com\/blog\/use-shipping-api-opencart\/\"},\"author\":{\"name\":\"Sarang Agrawal\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/3fe787f5e9200d06d3ebf9aa86af1558\"},\"headline\":\"How To Use Shipping Api In Opencart\",\"datePublished\":\"2017-02-03T16:15:17+00:00\",\"dateModified\":\"2023-07-26T06:12:19+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/webkul.com\/blog\/use-shipping-api-opencart\/\"},\"wordCount\":309,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/webkul.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/use-shipping-api-opencart\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/02\/Opencart-Code-Snippet.png\",\"keywords\":[\"REST API\"],\"articleSection\":[\"opencart\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/webkul.com\/blog\/use-shipping-api-opencart\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/webkul.com\/blog\/use-shipping-api-opencart\/\",\"url\":\"https:\/\/webkul.com\/blog\/use-shipping-api-opencart\/\",\"name\":\"How To Use Shipping Api In Opencart - Webkul Blog\",\"isPartOf\":{\"@id\":\"https:\/\/webkul.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/webkul.com\/blog\/use-shipping-api-opencart\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/use-shipping-api-opencart\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/02\/Opencart-Code-Snippet.png\",\"datePublished\":\"2017-02-03T16:15:17+00:00\",\"dateModified\":\"2023-07-26T06:12:19+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/webkul.com\/blog\/use-shipping-api-opencart\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/webkul.com\/blog\/use-shipping-api-opencart\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/use-shipping-api-opencart\/#primaryimage\",\"url\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/02\/Opencart-Code-Snippet.png\",\"contentUrl\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/02\/Opencart-Code-Snippet.png\",\"width\":825,\"height\":260},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/webkul.com\/blog\/use-shipping-api-opencart\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/webkul.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How To Use Shipping Api 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\/3fe787f5e9200d06d3ebf9aa86af1558\",\"name\":\"Sarang Agrawal\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/463bd0dd4a24de98604547719c1903e8af6b4133153ba8cc08799c7b2e3a5ce6?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\/463bd0dd4a24de98604547719c1903e8af6b4133153ba8cc08799c7b2e3a5ce6?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g\",\"caption\":\"Sarang Agrawal\"},\"sameAs\":[\"http:\/\/webkul.com\/blog\"],\"url\":\"https:\/\/webkul.com\/blog\/author\/sarang-agrawal032\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How To Use Shipping Api In Opencart - Webkul Blog","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\/use-shipping-api-opencart\/","og_locale":"en_US","og_type":"article","og_title":"How To Use Shipping Api In Opencart - Webkul Blog","og_description":"Today we will learn, how to use shipping API in an open cart and where the open cart uses this shipping API. Opencart uses the shipping API in the shipping details section while adding or editing the order from the admin end. After adding the payment details from the sales-&gt;orders when we click the continue [...]","og_url":"https:\/\/webkul.com\/blog\/use-shipping-api-opencart\/","og_site_name":"Webkul Blog","article_publisher":"https:\/\/www.facebook.com\/webkul\/","article_published_time":"2017-02-03T16:15:17+00:00","article_modified_time":"2023-07-26T06:12:19+00:00","og_image":[{"width":825,"height":260,"url":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/02\/Opencart-Code-Snippet.png","type":"image\/png"}],"author":"Sarang Agrawal","twitter_card":"summary_large_image","twitter_creator":"@webkul","twitter_site":"@webkul","twitter_misc":{"Written by":"Sarang Agrawal","Est. reading time":"8 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/webkul.com\/blog\/use-shipping-api-opencart\/#article","isPartOf":{"@id":"https:\/\/webkul.com\/blog\/use-shipping-api-opencart\/"},"author":{"name":"Sarang Agrawal","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/3fe787f5e9200d06d3ebf9aa86af1558"},"headline":"How To Use Shipping Api In Opencart","datePublished":"2017-02-03T16:15:17+00:00","dateModified":"2023-07-26T06:12:19+00:00","mainEntityOfPage":{"@id":"https:\/\/webkul.com\/blog\/use-shipping-api-opencart\/"},"wordCount":309,"commentCount":0,"publisher":{"@id":"https:\/\/webkul.com\/blog\/#organization"},"image":{"@id":"https:\/\/webkul.com\/blog\/use-shipping-api-opencart\/#primaryimage"},"thumbnailUrl":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/02\/Opencart-Code-Snippet.png","keywords":["REST API"],"articleSection":["opencart"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/webkul.com\/blog\/use-shipping-api-opencart\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/webkul.com\/blog\/use-shipping-api-opencart\/","url":"https:\/\/webkul.com\/blog\/use-shipping-api-opencart\/","name":"How To Use Shipping Api In Opencart - Webkul Blog","isPartOf":{"@id":"https:\/\/webkul.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/webkul.com\/blog\/use-shipping-api-opencart\/#primaryimage"},"image":{"@id":"https:\/\/webkul.com\/blog\/use-shipping-api-opencart\/#primaryimage"},"thumbnailUrl":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/02\/Opencart-Code-Snippet.png","datePublished":"2017-02-03T16:15:17+00:00","dateModified":"2023-07-26T06:12:19+00:00","breadcrumb":{"@id":"https:\/\/webkul.com\/blog\/use-shipping-api-opencart\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/webkul.com\/blog\/use-shipping-api-opencart\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/use-shipping-api-opencart\/#primaryimage","url":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/02\/Opencart-Code-Snippet.png","contentUrl":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/02\/Opencart-Code-Snippet.png","width":825,"height":260},{"@type":"BreadcrumbList","@id":"https:\/\/webkul.com\/blog\/use-shipping-api-opencart\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/webkul.com\/blog\/"},{"@type":"ListItem","position":2,"name":"How To Use Shipping Api 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\/3fe787f5e9200d06d3ebf9aa86af1558","name":"Sarang Agrawal","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/463bd0dd4a24de98604547719c1903e8af6b4133153ba8cc08799c7b2e3a5ce6?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\/463bd0dd4a24de98604547719c1903e8af6b4133153ba8cc08799c7b2e3a5ce6?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g","caption":"Sarang Agrawal"},"sameAs":["http:\/\/webkul.com\/blog"],"url":"https:\/\/webkul.com\/blog\/author\/sarang-agrawal032\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/73644","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\/124"}],"replies":[{"embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/comments?post=73644"}],"version-history":[{"count":8,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/73644\/revisions"}],"predecessor-version":[{"id":392744,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/73644\/revisions\/392744"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/media\/41008"}],"wp:attachment":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/media?parent=73644"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/categories?post=73644"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/tags?post=73644"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}