Changing the Stock status color style

Changing the Stock status color style in OpenCart

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.

2 comments

Leave a Reply

  1. Siarhei · July 22, 2015

    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!

    • janoshke · July 22, 2015

      I’m glad I could help!

      Cheers 🙂