I need to show something based on store id on Magento 2
for example;
<?php
$storeManager = \Magento\Framework\App\ObjectManager::getInstance()->get('\Magento\Store\Model\StoreManagerInterface');
if ($storeManager->getStore()->getStoreId() == 1):
?>
<div class="block-bottom">
<a class="button-sticky-bottom" href="<?php echo $this->getUrl('') ?>" >
<i class="fa fa-flag" style="font-size: 18px;"></i>
<span><?php echo __('Language'); ?></span>
</a>
</div>
<?php else: ?>
<div class="block-bottom">
<a class="button-sticky-bottom" href="<?php echo $this->getUrl('') ?>" >
<i class="fa fa-flag" style="font-size: 18px;"></i>
<span><?php echo __('Language1'); ?></span>
</a>
</div>
<?php endif; ?>
Best Answer
block file
.phtml file
you can use this in your
.phtml
file like thisSolution 2 - (I don't recommend this but as per your comment)
You can fetch the current store id and the store name in phtml file (using ObjectManager) like below
you can use this
$storeID
according to your condition :