Skip to content

Commit

Permalink
fix(storefront): BCTHEME-305 Price Lists - Price in the cart is not u…
Browse files Browse the repository at this point in the history
…pdated when changing currency on mobile
  • Loading branch information
BC-tymurbiedukhin committed Nov 4, 2020
1 parent 2049536 commit ed7d5af
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 8 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Changelog

## Draft
- Price in the cart is not updated when changing currency on mobile. [#1893](https://github.com/bigcommerce/cornerstone/pull/1893)

## 4.12.0 (11-03-2020)
- Reduce lodash usage in compare-products.js and image-gallery.js [#1827](https://github.com/bigcommerce/cornerstone/pull/1827)
Expand Down
6 changes: 1 addition & 5 deletions assets/js/theme/global/currency-selector.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,7 @@ export default function (cartId) {
});
}

$(document.body).on('click', '.currencySelector', () => {
$('.currency-selection-list').toggleClass('active');
});

$(document.body).on('click', '[data-cart-currency-switch-url]', event => {
$('[data-cart-currency-switch-url]').on('click', event => {
const currencySessionSwitcher = event.target.href;
if (!cartId) {
return;
Expand Down
18 changes: 15 additions & 3 deletions templates/components/common/currency-selector.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,19 @@
{{#if currency_selector.currencies.length '>' 1}}
<ul class="navUser-section">
<li class="navUser-item">
<a class="navUser-action navUser-action--currencySelector has-dropdown" href="#" data-dropdown="currencySelection" aria-controls="currencySelection" aria-expanded="false">{{lang 'common.currency' code=currency_selector.active_currency_code}} <i class="icon" aria-hidden="true"><svg><use xlink:href="#icon-chevron-down" /></svg></i></a>
<a class="navUser-action navUser-action--currencySelector has-dropdown"
href="#"
data-dropdown="currencySelection"
aria-controls="currencySelection"
aria-expanded="false"
>
{{lang 'common.currency' code=currency_selector.active_currency_code}}
<i class="icon" aria-hidden="true">
<svg>
<use xlink:href="#icon-chevron-down" />
</svg>
</i>
</a>
<ul class="dropdown-menu" id="currencySelection" data-dropdown-content aria-hidden="true" tabindex="-1">
{{#each currency_selector.currencies}}
<li class="dropdown-menu-item">
Expand All @@ -13,9 +25,9 @@
data-warning="{{lang 'common.currency_switch_promotion'}}"
>
{{#if is_active}}
<strong>{{name}}</strong>
<strong>{{name}}</strong>
{{else}}
{{name}}
{{name}}
{{/if}}
</a>
</li>
Expand Down
5 changes: 5 additions & 0 deletions templates/components/common/navigation-menu.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@
<a class="navPage-subMenu-action navPages-action"
href="{{{switch_url}}}"
aria-label="{{name}}"
data-currency-code="{{{code}}}"
{{#if cart_currency_switch_url.length '>' 0 }}
data-cart-currency-switch-url="{{{cart_currency_switch_url}}}"
{{/if}}
data-warning="{{lang 'common.currency_switch_promotion'}}"
>
{{#if is_active}}
<strong>{{name}}</strong>
Expand Down

0 comments on commit ed7d5af

Please sign in to comment.