Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.
Ruby b2b-commercee-commerceecommerceecommerce-apiecommerce-frameworkecommerce-platformheadlessheadless-commerceheadless-ecommercemarketplacemulti-tenantmulti-vendormulti-vendor-ecommerceopen-sourcespree-commerce
Fixed JS undefined errors when application does not use the updated 4.2 views
Damian Legawiec15a87ea29958
diff --git a/frontend/app/assets/javascripts/spree/frontend/currency.js b/frontend/app/assets/javascripts/spree/frontend/currency.jsindex 8b7ad051e3..9a84d51292 100644--- a/frontend/app/assets/javascripts/spree/frontend/currency.js+++ b/frontend/app/assets/javascripts/spree/frontend/currency.js@@ -29,15 +29,17 @@ document.addEventListener('turbolinks:load', function(event) {// fix back button issue with different currency set// invalidate page if cached page has different currency then the current onedocument.addEventListener('turbolinks:load', function(event) {- if (SPREE_CURRENCY === SPREE_DEFAULT_CURRENCY) {- var regexAnyCurrency = new RegExp('currency=')- if (event.data.url.match(regexAnyCurrency) && !event.data.url.match(SPREE_CURRENCY)) {- Spree.setCurrency(SPREE_CURRENCY)- }- } else {- var regex = new RegExp('currency=' + SPREE_CURRENCY)- if (!event.data.url.match(regex)) {- Spree.setCurrency(SPREE_CURRENCY)+ if (typeof (SPREE_DEFAULT_CURRENCY) !== 'undefined' && typeof (SPREE_CURRENCY) !== 'undefined') {+ if (SPREE_CURRENCY === SPREE_DEFAULT_CURRENCY) {+ var regexAnyCurrency = new RegExp('currency=')+ if (event.data.url.match(regexAnyCurrency) && !event.data.url.match(SPREE_CURRENCY)) {+ Spree.setCurrency(SPREE_CURRENCY)+ }+ } else {+ var regex = new RegExp('currency=' + SPREE_CURRENCY)+ if (!event.data.url.match(regex)) {+ Spree.setCurrency(SPREE_CURRENCY)+ }}}})