Menambahkan currency/symbol IDR Rupiah pada plugin woocommerce

Untuk menambahkan currency rupiah pada plugin woocommerce, buka file: woocommerce-admin-functions.php yang terletak di: namawebanda.com/wp-content/plugins/woocommerce/admin/woocommerce-admin-functions.php

masukkan kode berikut:


/**
* Menambah currency IDR Rp. pada plugin woocommerce
* Add a custom currency / symbol
* lukman.my.id
*/
add_filter( 'woocommerce_currencies', 'add_my_currency' );
function add_my_currency( $currencies ) {
$currencies['IDR'] = __( 'Indonesia (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;
}

 

Leave a Reply