Cara Menambahkan Rupiah (Rp) di WooCommerce

Masukkan mata uang Rupiah (Rp) di WooCommerce dengan menambahkan beberapa baris script di functions.php yang ada dalam folder theme yang aktif. File functions.php ada di direktori www/wp-content/themes/namathemeaktif/functions.php. Edit functions.php menggunakan editor yang anda gunakan seperti notepad++ atau dreamweaver. Tambahkan beberapa script berikut diakhir functions.php.

[box type=”info”] add_filter( ‘woocommerce_currencies’, ‘add_my_currency’ ); function add_my_currency( $currencies ) { $currencies[‘IDR’] = __( ‘Indonesian Rupiah (Rp)’, ‘woocommerce’ ); return $currencies; } add_filter(‘woocommerce_currency_symbol’, ‘add_my_currency_symbol’, 10, 2); function add_my_currency_symbol( $currency_symbol, $currency ) { switch( $currency ) { case ‘IDR’: $currency_symbol = ‘Rp’; break; } return $currency_symbol; }[/box]

 

Sekarang coba cek di setting admin Woocommerce bagian Currency, mata uang Rupiah (Rp) sudah muncul dan bisa digunakan.

Kalau suatu saat theme anda update pastikan function di atas masih ada di functions.php agar mata uang Rupiah tetap muncul di admin setting Woocommerce anda.

Leave a Reply

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