I have multiple stores on my website. I need to get the store currency code by store Id. How can I get it?
I was trying by below code but it’s always returning default store currency code:
$objectManager = MagentoFrameworkAppObjectManager::getInstance();
$storeManager = $objectManager->get('MagentoStoreModelStoreManagerInterface');
$storeCurrencyCode = $storeManager->getStore()->getCurrentCurrencyCode();
Thanks for your cooperation.
[Update with Solution]
I have got the solution after reviewing Magento core code. My solution code below:
$objectManager = MagentoFrameworkAppObjectManager::getInstance();
$storeManager = $objectManager->get('MagentoStoreModelStoreManagerInterface');
// Return Default Store Currency Code
$defaultCurrencyCode = $storeManager->getStore()->getCurrentCurrencyCode();
// Return Specific Store Currency Code
$storeId = 1; // it can be any store id
$storeCurrencyCode = $storeManager->getStore($storeId)->getCurrentCurrencyCode();
Thanks for your time.