Many Opencart users must be aware of this awful problem of Opencart, you can add a product which is out of stock. But you will not be allowed to checkout, which is completely frustrating to the users/shoppers. Recently i was working on an Opencart site and thought of fixing this problem. I was able to fix it without much sweat.
I am sharing it for all those Opencart users who wants to change the Add to Cart button to Out of Stock, for products which are not available.

Rule of the Thumb: Backup the said file before doing anything, in case anything bad happens.

Fire up your FTP program or your cPanel, and then open the following php file


Please note that the theme name will differ from site to site. For this tutorial, i am using emanipur as the theme name.

After opening that file, find the Add to cart button which is somewhat like this 

<input type="button" value="<?php echo $button_cart; ?>" id="button-cart" class="button cart-product" />

Please note that the button Id and class may be different for your theme. The only thing you need to look out is the $button_cart value.

Now, remove the above lines and change with the following slightly modified code

<?php if ($stock == "In Stock")
               <input type="button" value="<?php echo $button_cart; ?>" id="button-cart" class="button cart-product" />
         <?php }
              <a class="button" style="font-size:16px;">Out of Stock</a>

That's it. Now instead of that Add to Cart button, it will be replaced by Out of Stock button/text.
Please remember that i am using my own button class for the Out of Stock button, you can create or use your own class to suit your theme appearance.

Feel free to contact us, if you have any problems.
Published in eManipur! Blog
Sometimes in Opencart you may want to add additional weight to every orders made so that you would not have to worry about all that packaging weight. We came across such situation and we thought of adding 100gm to every orders while checking out, so that we don't have to worry about that extra weight of Packaging materials. Please note that, this is meant for Weight Based Shipping in Opencart.

You will need to edit a file only to achieve this. Read on to know how to do this.

Fire up your FTP client or cPanel(if you are using it). After that navigate to /public_html/catalog/model/shipping and there you will find a file named weight.php. Open it using your favorite editor or cPanel File Editor(if you are using cPanel File Manager).

Navigate to line 26 and add the following codes
                            $weight = $weight + .100;

And after adding it, your code should look like the following

Opencart Additional Weight

That's it, an additional 100gm will be added to every orders made by your customers.

If you are adding this additional weight, do not forget to update your Terms and Conditions/Shipping Policy/Delivery Policy. If you do not do so, it will be like cheating your customer of this additional weight.

If you have any questions, feel free to drop a comment below..
Published in eManipur! Blog

Our Services

  • Web Design & UX Design
  • eCommerce sites
  • Social Media Marketing
  • Joomla Upgrade and troubleshooting
  • Blogging
  • Website Maintenance

Latest Offer from eManipur!

Joomla   Upgrade Your Old Joomla Website For Free*.
   For More Information click on the Link Below.

Upgrade Joomla

Drop in here

Keishamthong Elangbam Leikai,
Imphal -795001,
Manipur, India

Emanipur Location


+91 97742 70 499

Subscribe to our Tips

Receive our tips and hacks right into your Inbox. We promise you, it will be be a unique experience for you.

Receive HTML?

Social Icon
Facebook    Linked In    Gplus     Twitter