OpenCart Tips: How to Remove Add to Cart button for Out of Stock items?

Leave a Comment
Today, I will show you How to Remove Add to Cart button for Out of Stock items.There are several ways of dealing with Out of Stock products. Some of us don't want customers to be able to buy products that are out of stock.
OpenCart Tips: How to Adding the Google Analytics code to OpenCart?

OpenCart has an option AP > System > Settings > {Edit store} > Option > Stock, mark Stock Checkout as No) that disallows customers to check out if they have an out of stock item in their shopping cart. This is a start, but for many of us it's just not consequential!

Hence this mod. This extension removes the Add to Cart button and replaces it with an "Out of stock" message for out-of-stock products. This way, customers can't even place an out-of-stock product into their shopping carts.

Because this is a vQmod, no core files are touched, and the changes should carry over to the next version.

This is a vQmod for Opencart. Hence you need OpenCart and vQmod preinstalled.
This vQmod is made for the default theme. Hence you should have the default theme as the active theme for this to work. While you can very easily modify this for other themes, the out-of-the-box support is only for default theme. If you don't know how, and need me to do paid customization, please PM me.
Please note that this mod applies to all pages and modules shipped in Opencart core. But if you have an additional module or page containing an Add to Cart button, then unfortunately this mod will not affect it. You can modify the mod to affect that module/page, but the out-of-the-box support is only for OC default package.

Upload the contents of the uploads folder to your shop's root folder.

How do I change the color/size/font of the out of stock message?

Use CSS to style the class outofstock
(e.g. by using ... on_id=6241 )

Now write the following code:
.outofstock {
color: red;
font-size: 12px;

How do I change the text of the out of stock message?
AP > System > Localisation > Stock Statuses > {Edit Out of Stock}

OpenCart Hosting Recommendation

HostForLIFEASP.NET receives Spotlight standing advantage award for providing recommended, cheap and fast ecommerce Hosting including the latest OpenCart. From the leading technology company, Microsoft. All the servers are equipped with the newest Windows Server 2012 R2, SQL Server 2014, ASP.NET 4.5.2, ASP.NET MVC 6.0, Silverlight 5, WebMatrix and Visual Studio Lightswitch. Security and performance are at the core of their OpenCart hosting operations to confirm every website and/or application hosted on their servers is highly secured and performs at optimum level. mutually of the European ASP.NET hosting suppliers, HostForLIFE guarantees 99.9% uptime and fast loading speed. From €3.00/month , HostForLIFE provides you with unlimited disk space, unlimited domains, unlimited bandwidth,etc, for your website hosting needs.

Next PostNewer Post Previous PostOlder Post Home


Post a Comment