• 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

Woocommerce product attributes with hierarchy like categories

Log a user out of a website when they put their computer to sleep

how to prevent float variables displaying as scientific notation when printing [duplicate]

How Can I Do LIMIT 1, 2 In WP_Query

WooCommerce - unset "<product> removed notice…" on cart page

SQL AVG() to 2 decimals

Applying programmatically a coupon to an Order in WooCommerce3

How do I call a php file with axios?

Fatal error: Trait 'LaminasDbAdapterLaminasDbAdapterAdapterInterface' not found in /var/www/vendor/laminas/laminas-db/src/Adapter/Adapter.php

Target Laravelista is not instantiable

How to submit the custom form data in database in WordPress without plugin using ajax?

Custom post type single page not working

Transpose multidimensional array and join values with commas

How to set a domain name with php artisan serve

Yii Ajax Submit button

About Contact Privacy policy Terms and conditions