• Categories
    • PHP
    • phpMyAdmin
    • PHPMailer
    • FFMpeg
    • PHPEXcel
    • PHPDoc
    • PHPUnit
    • CakePHP
    • CakePHP 2.0
    • Cake PHP 2.1
    • CakePHP Model
    • Facebook PHP SDK
    • composer-php
    • PHP 7
    • PHP GD
    All Categories
  • About

wordpress function breaks wp-admin

phpwordpressfunctionwoocommerce


PHP Snippet 1:

function geo_client_currency( $client_currency ) {
    if ( WC()->customer ) {
        $country = WC()->customer->get_shipping_country();

        /**
         * Assuming more are going to be added otherwise a switch is overkill.
         * Short example: $client_currency = ( 'GB' === $country ) ? 'GBP' : 'EUR';
         */
        switch ( $country ) {
            case 'GB': 
                $client_currency = 'GBP'; 
                break;

            default: 
                $client_currency = 'EUR';
        }
    }

    return $client_currency;
}
add_filter( 'wcml_client_currency', 'geo_client_currency' );

Related Snippets

Converting IPv6 to IPv4 address in PHP

Only on Firefox "Loading failed for the <script> with source"

Backend cannot be reached after Typo3 login screen

Limit of log line written to Apache Errorlog from mod php error_log

Show Custom Data in Woocommerce Order Details Admin Area

Adding reCAPTCHA v2 into my PHP file

Jquery DataTables: Data not displaying in table via Ajax

Live search query using JS and PHP for QA forum

Woocommerce product attributes with hierarchy like categories

OctoberCMS / Anonymous Global Scope

How to solve cURL error 60: SSL certificate in Laravel 5 while Facebook authentication

Why "Class 'GuzzleHttpClient' not found" even after Installing it in Laravel?

Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given [duplicate]

Debugging Stripe Webhook Event

Select option from dropdown menu with PHP and mySql

About Contact Privacy policy Terms and conditions