• 23/10/2022 • 2 phút đọc • 11 lượt xem

How to add custom currency symbol in WooCommerce

Việt Lâm Coder
Việt Lâm Coder
Senior Fullstack & System Architect • Hotline: 0944.71.4545

Sometimes you need your own currency symbol in your store. For example, if your currency is Singapore Dollar, the WooCommerce shows it as “$”. Your site visitors will be confused about whether it is a US Dollar or which currency. In this article, we will see how to add a custom currency symbol in WooCommerce for products, carts, and checkout using the filter hook method.

To make your currency symbol precise and more informative you can introduce your own symbol which helps users to understand the currency.

You need to add the following snippet in functions.php of your child theme:

<?php
// add custom currency in WooCommerce settings
add_filter( 'woocommerce_currencies', 'add_c_currency' );
function add_c_currency( $c_currency ) {
$c_currency['SING_DOLLAR'] = __( 'Singaporian Dollar ', 'woocommerce' );
return $c_currency;
}

// define custom currency symbol
add_filter('woocommerce_currency_symbol', 'add_c_currency_symbol', 10, 2);
function add_c_currency_symbol( $custom_currency_symbol, $custom_currency ) {
switch( $custom_currency ) {
case 'SING_DOLLAR': $custom_currency_symbol = 'SG';
break;
}
return $custom_currency_symbol;
}
?>


This snippet will add a custom currency symbol in WooCommerce.

Please note that you can add your own currency symbol here. I have added a new currency with the name “Singaporian Dollar” and the symbol I like is “SG$”.

The “SG” is a country code of Singapore so instead of showing “$” it is more informative to show “SG$”.

How to select the currency in WooCommerce


Navigate to WooCommerce > Settings > General and scroll down till “Currency Options”.

Under currency, you will see your currency name (Singaporian Dollar in my case)


Click “Save Changes” and open the products page of your store and your new currency symbol will be reflected.

Examples


Once the snippet is added, this is how the currency will look like:
Products

The products grid:


Cart Table

The cart table with totals:

Việt Lâm Coder

Việt Lâm Coder

Tác giả bài viết và chuyên gia quản trị website. Nếu bạn gặp khó khăn trong quá trình thực hiện hoặc có nhu cầu thiết kế website, lập trình web app Laravel, hãy liên hệ ngay với tôi qua Hotline / Zalo: 0944.71.4545.

☕ Mời Tác Giả Ly Cà Phê Ấm Lòng

Nếu bài viết này giúp ích cho công việc của bạn, hãy tiếp thêm động lực cho tác giả duy trì kho tri thức bằng một ly cà phê ấm lòng nhé!

Mã QR ủng hộ tác giả
Ngân hàng TMCP Quân Đội (MB Bank)TONG VIET LAM

Có Thể Bạn Quan Tâm

Cách Mở Tab Ẩn Danh Trên Safari MacBook Đơn Giản

Cách mở tab ẩn danh trên Safari MacBook sẽ giúp cho người dùng có thể bảo vệ quyền riêng tư và duyệt web một cách an toà...

Hướng dẫn 5 cách tắt update Windows 11 vĩnh viễn chi tiết nhất

Mặc định Windows 11 sẽ được tự động cập nhật trong nền. Tuy nhiên nếu vì lý do nào đó mà bạn không muốn nhận các bản...

Hướng dẫn trỏ file hosts cho domain trên hệ điều hành Windows

– Làm cách nào để 1 website có thể hoạt động trên Share hosting, VPS, Server mà không cần cấu hình các record DNS cho do...

Kích hoạt Cloudflare Turnstile trong Contact Form 7 chống spam

Cloudflare Turnstile là giải pháp xác thực không dùng CAPTCHA giúp bảo vệ website WordPress khỏi spam một cách nhẹ nhàng...

Cách Sử Dụng DeepSeek R1 Miễn Phí Trong Visual Studio Code Với Cline?

Hãy đối mặt với thực tế: Các trợ lý lập trình AI như GitHub Copilot thì tuyệt vời, nhưng chi phí đăng ký của chúng có th...

Gmail API – Tất cả những gì bạn cần biết - 2025

Nếu bạn đang tìm cách tích hợp Gmail vào các ứng dụng của riêng mình thì Gmail API chính là thứ bạn cần! Gmail là một lự...

Hướng dẫn tạo màn hình desktop ảo bằng Task View trên Surface Windows 11

Việt Lâm Coder sẽ hướng dẫn tạo lập nhiều màn hình desktop ảo bằng Task View trên Surface Windows 11 để sắp xếp các tác...

How to Transfer PuTTY Sessions To Another Windows Machine

his is an user contributed article. PuTTY is a terminal emulator application which can act as a client for the SSH, T...

Hướng dẫn cách kiểm tra cổng đang mở (Check open port) trên linux

Với nhiều năm kinh nghiệm hỗ trợ Khách hàng của Tenten, chúng tôi nhận thấy việc thường xuyên theo dõi kiểm tra hoạt độn...

Kiểm tra tất cả các port mà Cyber Panel đang cần có được mở hay không ?

Để kiểm tra tất cả các port cùng một lúc, bạn có thể sử dụng lệnh: netstat -tulpn | grep -E ':(8090|80|443|21|40110|401...

Hướng dẫn cài đặt KeyHelp Panel

Tóm tắt về KeyHelp Bạn đã có phần cứng tốt nhất cho các dự án Internet của mình nhưng việc quản lý phức tạp, hiệu suất...

Tổng hợp danh sách Control Panel VPS free tốt nhất hiện nay

Control Panel VPS free cung cấp một lựa chọn tuyệt vời cho những người dùng muốn quản lý VPS một cách dễ dàng và hiệ...