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
Include currency in JS localized paths
Damian Legawiec29c953698849
diff --git a/core/app/assets/javascripts/spree.js b/core/app/assets/javascripts/spree.jsindex 26fd681ad8..4878b6ca0f 100644--- a/core/app/assets/javascripts/spree.js+++ b/core/app/assets/javascripts/spree.js@@ -22,16 +22,20 @@ Spree.pathFor = function (path) {}Spree.localizedPathFor = function(path) {- if (typeof (SPREE_LOCALE) !== 'undefined') {- if (path.match(/api\/v/)) {- if (path.match(/\?/)) {- path = path + '&locale=' + SPREE_LOCALE- } else {- path = path + '?locale=' + SPREE_LOCALE- }+ if (typeof (SPREE_LOCALE) !== 'undefined' && typeof (SPREE_CURRENCY) !== 'undefined') {+ var fullUrl = new URL(Spree.pathFor(path))+ var params = fullUrl.searchParams+ var pathName = fullUrl.pathname++ params.set('currency', SPREE_CURRENCY)++ if (pathName.match(/api\/v/)) {+ params.set('locale', SPREE_LOCALE)} else {- path = SPREE_LOCALE + '/' + path+ pathName = SPREE_LOCALE + '/' + pathName}++ path = pathName + '?' + params.toString()}return Spree.pathFor(path)}