Home Forums Hotel WP Add New Currency

Add New Currency

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #220769

    Thoa Kim
    Moderator

    Hello guys, now I guide you how to add new currency:

    – Firstly, be sure that your site is using Hotel WP theme and WP Hotel Booking the latest version.

    – Install child theme for your site (Dashboard >> Hotel WP >> Child Theme)

    – In functions.php file of the child theme, add the following code:

    add_filter( 'hb_payment_currencies', 'add_new_currency' );
    
    function add_new_currency( $currencies ) {
        $currencies['currency_key'] = 'enter_currency_name';
        return $currencies;
    }
    
    add_filter('hb_currency_symbol', 'add_new_currency_symbol', 10, 2);
    function add_new_currency_symbol($symbol, $currency){
    if($currency == 'currency_key'){
    $symbol = 'enter_currency_symbol';
    }
    return $symbol;
    }

    For example: I’ll add US currency. The code I use is:

    add_filter( 'hb_payment_currencies', 'add_new_currency' );
    
    function add_new_currency( $currencies ) {
        $currencies['US'] = 'US Dollar';
        return $currencies;
    }
    
    add_filter('hb_currency_symbol', 'add_new_currency_symbol', 10, 2);
    function add_new_currency_symbol($symbol, $currency){
    if($currency == 'US'){
    $symbol = '$';
    }
    return $symbol;
    }

    Done!!! Now your new currency is ready in WP Hotel Booking >> Settings >> Currency.

    If you have difficulties in adding the currency, please open your own topic. Don’t reply in this one.

    Regards

    Thoa Kim

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic. You can click here