magento 2 get store id php
I need to show something based on store id
for exapmle;
<?php if ($store == "2") {?>
<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 } ?>
4
Answers
It didnt worked. What is wrong?
The use of object manager is not recommended. It is better to arrange this code for the class of the block using the constructor
I would recommend injecting the StoreManagerInterface in your construct and avoid using the object manager.
Example