Skip to content

Commit

Permalink
Fix: "Unavailable in (currency)" on the storefront - support#215
Browse files Browse the repository at this point in the history
Merge branch 'fix/storefront-unavailable-in-currency' into 'master'

See merge request schema/origin-storefront!190
  • Loading branch information
Yury Shelest committed Jun 22, 2022
2 parents 7689e55 + b6ad7ba commit 9662037
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions utils/getPriceInCurrency.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import isNumber from 'lodash/isNumber';

export const getPriceInCurrency = (product, currency) => {
const prices = {
currency: currency.toLowerCase(),
Expand Down Expand Up @@ -69,7 +71,7 @@ export const getStandardPriceInCurrency = (product, currency) => {
const price = standardCurrency[currency];

if (price) {
if (standard.sale) {
if (standard.sale && isNumber(standard.salePrice)) {
return price.salePrice;
}

Expand All @@ -90,7 +92,7 @@ export const getStandardPriceInCurrency = (product, currency) => {
}

if (product.currency === currency.toUpperCase() && product.price) {
if (product.sale) {
if (product.sale && isNumber(product.salePrice)) {
return product.salePrice;
}

Expand Down

0 comments on commit 9662037

Please sign in to comment.