• 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

Need to display only array value in JSON output

Why getting "Build step 'Execute shell' marked build as failure" error while creating a backup tar for files

PHP: Calling MySQL Stored Procedure with Both INPUT AND OUTPUT Parameters (NOT "INOUT")

php script to delete files older than 24 hrs, deletes all files

Passing PHP JSON to Javascript: echo json_encode vs echo json declaration

I'm trying to use curl with php but getting this error:Could not resolve host: Bearer

RabbitMQ PRECONDITION_FAILED - unknown delivery tag

What is my SQL missing?

Display the WooCommerce product price inside a custom function

Backend cannot be reached after Typo3 login screen

Move a child array to parent array and change parent/child name

GA4 custom event from server side, can someone tell me how i can do the following code in php?

loop through an anchor id

Wordpress wpdb->delete issue

Creating command to backup MySql database in Laravel

About Contact Privacy policy Terms and conditions