Changing the Stock status color style in OpenCart

Changing the Stock status color style

By default in OpenCart style settings we have this boring grey stock status words that purely says In Stock. I suppose you would like to add some new color styling to that status order to stand out and be more visible.

Changing the Stock status color style in OpenCart in 3 easy steps

stock-status-default

1. Go to: catalog/language/your_default_language/product and open the product.php file in your prefered text editor.

2. Find the following line:

$_['text_instock'] = 'In Stock';

3. Edit to:

$_['text_instock'] = '<span style="color: #00cc00;">In Stock</span>';

Please note that the following image shows example for Serbian language, thus you should navigate to the directory accordingly to your default website language. In Serbian language the status “In Stock” is translated as “Na lageru”. Also the text color in this example is green (#00cc00) but you can use your prefered color.

stock-status-green

The images show both the 2.0.3.1. and 1.5.4. versions since it is the same setting and result in both cases. And that’s how changing the Stock status color style in OpenCart is done.

The next logical, although technically different, change for the Stock status is styling the “Out Of Stock” status.

By janoshke

Web developer and IT consultant. Freelancer with full respect for OpenCart and WordPress. Gamer, (ex)drummer and parent.

2 comments

  1. Thank you very much! I am not a developer but trying to do my best in opencart webstore building. You post save my time, thank you! Hvala!

Leave a Reply