OpenCart is an engrossing eCommerce platform that is being used on a large scale globally due to the presence of a wide range of features and functionalities. Also, 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 their 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 “How to change the currency format in OpenCart as per the Indian currency system?”
Recommended Read: 5 Questions to ask while going for an OpenCart Platform
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 into the standard currency format in the OpenCart platform.
By default, OpenCart follows a standard currency format that 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.
Recommended Read: Decoding the OpenCart Platform Briefly in eCommerce Scenario
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 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
- First, edit file /system/library/currency.php. We recommend you create a backup of this file before editing it.
- Next, you need to search the line given below,
$string .= number_format(round($value, (int)$decimal_place), (int)$decimal_place, $decimal_point, $thousand_point);
- Then, 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.
Recommended Read: What are the merits and demerits of using an OpenCart platform?
These are the simple steps that need 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 the functionality and performance of an OpenCart store, you need to visit the Knowband site. Besides, providing wonderful extensions for Magento 2, OpenCart, WooCoomerce and PrestaShop sites, the company is capable of providing customized plugin development services to its worldwide clients.
For platforms like Magento 2, Prestashop, OpenCart, and WooCommerce, we offer the greatest plugins. Also, for the website and modules, we offer custom module development and modification services. Besides that, we have a dedicated support team that is always available to aid clients when they need any assistance from us in order to deliver the best and most effective post-sale support to our customers. Moreover, on weekends, we continue to fulfil our obligations to customers who need assistance with urgent website problems. Also, in case of doubts or queries related to the OpenCart Module functionality feel free to drop us an email at support@Knowband.com