You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
483 B
20 lines
483 B
<?php
|
|
|
|
namespace WCML\MultiCurrency;
|
|
|
|
use WCML\StandAlone\IStandAloneAction;
|
|
|
|
class GeolocationFrontendHooks implements \IWPML_Frontend_Action, IStandAloneAction {
|
|
|
|
const KEY_CLIENT_COUNTRY = 'wcml_client_country';
|
|
|
|
public function add_hooks() {
|
|
if ( Geolocation::isUsed() ) {
|
|
add_action( 'init', [ self::class, 'storeUserCountry' ] );
|
|
}
|
|
}
|
|
|
|
public static function storeUserCountry() {
|
|
wcml_user_store_set( self::KEY_CLIENT_COUNTRY, Geolocation::getUserCountry() );
|
|
}
|
|
}
|
|
|