Vendor/Module/etc/frontend/events.xml
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
<event name="controller_action_predispatch">
<observer name="change_title_filter" instance="VendorModuleObserverCustomercurrency" />
</event>
</config>
Vendor/Module/Observer/Customercurrency.php
<?php
namespace VendorModuleObserver;
use MagentoFrameworkEventObserverInterface;
use MagentoFrameworkEventObserver;
use MagentoFrameworkViewLayoutInterface;
class Customercurrency implements ObserverInterface
{
protected $context;
public function __construct(
MagentoCustomerModelSession $customerSession,
MagentoFrameworkViewElementTemplate $context,
MagentoFrameworkViewResultPage $resultPage,
MagentoFrameworkViewPageConfig $pageConfig,
MagentoStoreModelStoreManagerInterface $storeManager
) {
$this->_customerSession = $customerSession;
$this->pageConfig = $pageConfig;
$this->resultPageFactory = $resultPage;
$this->context = $context;
$this->_storeManager = $storeManager;
}
public function execute(MagentoFrameworkEventObserver $observer)
{
if($this->_customerSession->isLoggedIn()) {
$customercurr = $this->helperData->getCurrenyCustomer();
$customerGroup = $this->_customerSession->getCustomer()->getGroupId();
$customergroupid = 1;
if($customerGroup == $customergroupid){
$this->_storeManager->getStore()->setCurrentCurrencyCode('GBP');
break;
}else{
$this->_storeManager->getStore()->setCurrentCurrencyCode('USD');
}
}
}
}

