How can you change the currency format in an OpenCart platform? | Knowband

How can you change the currency format in an OpenCart platform?

OpenCart is an engrossing eCommerce platform that is being used on a large scale globally due to the presence of wide range of features and functionalities. It has emerged as a promising platform for new and experienced site owners equally with its impeccable eCommerce features.

With its multi-currency support feature, brilliant themes, and OpenCart extensions, it has found its clients all across the world that want to carry out the business in their native language. However, I have seen numerous site owners who are unable to implement changes in the currency format on their OpenCart store. Through interaction with those customers, I found the common problem about “How to change the currency format in OpenCart as per the Indian currency system?”

Understanding the sensibilities and concerns of all those store owners that are facing this issue, here is the solution for you. Before we move ahead in this direction, let us have an insight about the standard currency format in the OpenCart platform.

By default, OpenCart follows a standard currency format which places a comma (,) after every three digit in a number while displaying the price but this is not the case with the Indian currency format. For example, store owners who are targeting customers residing in India want to change the price format from $ 1,000,000 to INR 10,00,000 which represents the Indian decimal value system.

To carry out this customization, OpenCart store owners need to understand the fact that there is no back end functionality available in the admin panel to make this change. However, the required changes can be accomplished by making the required changes in the core OpenCart files. Below are the steps that can guide OpenCart store owners in the right direction.

For OpenCart platform 2.2.x.x and above

  • Edit file /system/library/cart/currency.php. We recommend you to create a backup of this file before editing it.
  • You need to search the below line,

$string .= number_format($amount, (int)$decimal_place, $this->language ->get(‘decimal_point’), $this->language->get(‘thousand_point’));

Now, you need to replace the above line with the code given below,

$string .= number_format($amount, (int)$decimal_place, $this->language->get(‘decimal_point’), $this->language->get(‘thousand_point’));
$string1=substr($string,0,1);
$string2=substr($string,1);
$string2=str_replace(‘,’,”,$string2);
setlocale(LC_MONETARY,’en_IN’);
$string = $string1.money_format(‘%!i’, $string2);

  • You need to save the file with implemented changes for acquiring the desired currency format.

For all other OpenCart versions before 2.2.x.x

  • Edit file /system/library/currency.php. We recommend you to create a backup of this file before editing it.
  • You need to search the line given below,

$string .= number_format(round($value, (int)$decimal_place), (int)$decimal_place, $decimal_point, $thousand_point);

Now, you need to replace the above line with the code given below,

$string .= number_format(round($value, (int)$decimal_place), (int)$decimal_place, $decimal_point, $thousand_point);
$string1=substr($string,0,1);
$string2=substr($string,1);
$string2=str_replace(‘,’,”,$string2);
setlocale(LC_MONETARY,’en_IN);
$string= $string1.money_format(‘%!i’, $string2);

  • Finally, you need to save the file with the implemented changes to get the desired currency format.

These are the simple steps that needs to be implemented by OpenCart site owners to achieve the Indian currency format while displaying the product pricing to its customers. In case, you need any other OpenCart extensions to improve functionality and performance of an OpenCart store, you need to visit the Knowband site. Besides, providing the wonderful extensions for Magento, OpenCart, and PrestaShop sites, the company is capable of providing customized plugin development services to its worldwide clients.

This Would Also Interest You:

Joe Parker

We boast of the best in the industry plugins for eCommerce systems and has years of experience working with eCommerce websites. We provide best plugins for platforms like - Magento, Prestashop, OpenCart and Shopify. We also provide custom module development and customization services for the website and modules.

Leave a Reply

Your email address will not be published. Required fields are marked *