How to Hide Other Shipping Methods if Free Shipping is Available in OpenCart 2.3.x & 3.x

Ah, good old free shipping. The reason so many checkouts are being confirmed worldwide.

In fact, free shipping is the reason for 9 out of 10 online shoppers to make more purchases from E-Commerce sites in 2016.

Let’s show a neat trick that will let you enhance the efficiency of your free shipping in OpenCart 3.x.

Imagine a customer enters your store and selects a product.

Say the product costs enough to be eligible for free shipping, but your store also supports other shipping methods apart from the free one.

With this modification, all other shipping methods will not be shown in the checkout so the customer can only see the free shipping option.

An offer they can’t refuse, right?
 



​Let’s explain how to make the modification. It’s very simple.

For OpenCart 3.x

Copy this piece of code:

<modification>
    <name>Show Only Free Shipping if Available</name>
    <version>3.0 (Initial)</version>
	<link>https://isenselabs.com</link>
	<author>iSenseLabs</author>
	<code>isenselabs_freeshippingmod</code>
  
	<file path="catalog/model/extension/shipping/*.php">
		<operation error="skip">
			<search><![CDATA[if ($status) {]]></search>
			<add position="before"><![CDATA[
			if (get_class($this)!='ModelExtensionShippingFree') {
              if (($this->config->get('shipping_free_status') == 1) && (float)$this->cart->getTotal() >= $this->config->get('shipping_free_total')) {
                 $status = false;
              }
			}
			]]></add>
		</operation>
	</file>
</modification>

For OpenCart 2.3.x

<modification>
    <name>Show Only Free Shipping if Available</name>
    <version>3.0 (Initial)</version>
	<link>https://isenselabs.com</link>
	<author>iSenseLabs</author>
	<code>isenselabs_freeshippingmod</code>
  
	<file path="catalog/model/extension/shipping/*.php">
		<operation error="skip">
			<search><![CDATA[if ($status) {]]></search>
			<add position="before"><![CDATA[
			if (get_class($this)!='ModelExtensionShippingFree') {
              if (($this->config->get('free_status') == 1) && (float)$this->cart->getTotal() >= $this->config->get('free_total')) {
                 $status = false;
              }
			}
			]]></add>
		</operation>
	</file>
</modification>


...and paste it into a text editor.
 



free shipping modification opencart 3

Save the file with the name install.xml.

After that, compress it into a .ZIP file and rename it to something like freeshippingonly.ocmod.zip.

Any name will work if you keep the .ocmod.zip part.

Next, go to your OpenCart 3.x admin panel and go to Extensions > Installer.

Upload the .ZIP file you just created.

Now go to Extensions > Modifications and hit the Refresh button for the modification to be applied.

That’s it!

Now you can test it.

Go to the storefront, add a product in your cart (one that will meet your free shipping conditions) and proceed to the checkout.

free shipping opencart 3.x

All other shipping methods are hidden.

Take this free modification and start converting more of your customers!

Join 11,000+ subscribers receiving actionable E-commerce advice

* Unsubscribe any time
comments powered by Disqus