• 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

How to Create WooCommerce Subscription Product via. REST API?

Laravel UUID generation

Match single unknown parameter php (Morse-code Regex)

How to override htaccees file for cache control header

PHP - Store information with NO database

protect my blog content

Set quantity minimum, maximum and step at product level in Woocommerce

How to connect to MSSQL Server with PHP from Ubuntu 18.04?

woocommerce_wp_select options array from product attribute terms

How to send upload image through email

how to get value from array in laravel

how to pass row id in href of a tag in codeigniter controller?

possible options to create pdf file using html elements to generate invoice in php and codeigniter

MySQL/PHP - Web Based Game -User specific inventory table or 1 giant table? Another option?

PhP how to calculate moments with variables rows

About Contact Privacy policy Terms and conditions