Skip to content

digifoxlk/woocommerce-currency-symbol-customizer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 

Repository files navigation

WooCommerce Currency Symbol Customizer

This small WordPress snippet allows you to change the default currency symbol in WooCommerce. For example, it replaces the Australian Dollar symbol (A$) with a more explicit format (AUD$).

Code Example

add_filter('woocommerce_currency_symbol', 'change_existing_currency_symbol', 10, 2);

function change_existing_currency_symbol( $currency_symbol, $currency ) {
    switch( $currency ) {
        case 'AUD': 
            $currency_symbol = 'AUD$'; 
            break;
    }
    return $currency_symbol;
}

How to Use

You can add this snippet in one of the following ways:

Option 1: Theme functions.php

  1. Open your active theme folder: /wp-content/themes/your-theme/
  2. Edit the functions.php file.
  3. Paste the code at the end of the file.
  4. Save changes and refresh your WooCommerce store.

Option 2: Child Theme functions.php (Recommended)

  1. Open your child theme folder: /wp-content/themes/your-child-theme/
  2. Edit the functions.php file.
  3. Paste the code there and save.
  4. Your currency symbol will update automatically.

Option 3: Custom Plugin

  1. Create a new plugin file inside: /wp-content/plugins/
  2. Add the snippet inside your plugin file, wrapped with plugin headers.
  3. Activate the plugin from the WordPress dashboard.

Customization

You can extend the switch statement to include more currencies. For example:

switch( $currency ) {
    case 'AUD': $currency_symbol = 'AUD$'; break;
    case 'USD': $currency_symbol = 'US$'; break;
    case 'GBP': $currency_symbol = '£'; break;
}

Requirements

  • WordPress
  • WooCommerce plugin

About

A lightweight snippet to change and customize WooCommerce currency symbols in WordPress.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages