This widget is used to manage the currencies of the store. Here you can get the list of all the currencies activated in your store and apply one of the currencies in the store.
currencies | It provides the list of all the currencies enabled in the store from admin panel.
|
---|
setCurrency | This is used to apply or change the currency on your store from the storefront. You need to pass selected currency object here as an argument. |
---|
<div v-if="ms.settings.currencies.length > 1">
<div class="currency-dropdown dropdown">
<span role="button" data-bs-toggle="dropdown">
<span class="currency-flag me-2" :class="'currency-flag-'+ms.user.currency.name.toLowerCase()"></span>
<span>{{ms.user.currency.name}}</span>
<i class="bi bi-chevron-down ms-2 lh-1"></i>
</span>
<ul class="dropdown-menu dropdown-menu-end border-0 shadow-sm" data-bs-popper="static">
<li class="dropdown-item py-1" v-for="currency in ms.settings.currencies">
<span role="button" class="d-flex align-items-center" role="button" @click="ms.setPreferences({currency: currency})">
<span class="currency-flag me-2" style="height:20px;width:30px;background-size:100% 100%;" :class="'currency-flag-'+currency.toLowerCase()"></span>
{{currency}}
</span>
</li>
</ul>
</div>
</div>
<span ng-if="ms.settings.currency_settings.length> 1" class="ms-pr-0" ms-widget="ms.currencies">
<div ng-init="selected_currency = base_currency">
<select ng-model="selected_currency" class="ms-bg-none ms-border-none"
ng-change="setCurrency(selected_currency)"
ng-options="currency.name for currency in currencies">
</select>
</div>
</span>