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
Stripe locale param from URLs when it's not supported
Damian Legawiec02ba2af8f8e2
diff --git a/frontend/app/controllers/spree/store_controller.rb b/frontend/app/controllers/spree/store_controller.rbindex cdf422285d..e5949c824f 100644--- a/frontend/app/controllers/spree/store_controller.rb+++ b/frontend/app/controllers/spree/store_controller.rb@@ -6,6 +6,8 @@ module Spreeskip_before_action :verify_authenticity_token, only: :ensure_cart, raise: false+ before_action :redirect_to_default_locale+def account_linkrender partial: 'spree/shared/link_to_account'fresh_when(etag: [try_spree_current_user, I18n.locale])@@ -50,5 +52,11 @@ module Spreedef store_last_modified(current_store.updated_at || Time.current).utcend++ def redirect_to_default_locale+ return if params[:locale].blank? || supported_locale?(params[:locale])++ redirect_to url_for(request.parameters.merge(locale: nil))+ endendenddiff --git a/frontend/spec/features/locale_spec.rb b/frontend/spec/features/locale_spec.rbindex de176bdfbd..6be6f1d337 100644--- a/frontend/spec/features/locale_spec.rb+++ b/frontend/spec/features/locale_spec.rb@@ -186,5 +186,23 @@ describe 'setting locale', type: :feature, js: true doit_behaves_like 'translates UI'it_behaves_like 'generates proper URLs'end++ context 'not supported locale' do+ context 'home page' do+ before do+ visit spree.root_path(locale: 'es')+ end++ it { expect(page).to have_current_path('/') }+ end++ context 'product page' do+ before do+ visit spree.product_path(product, locale: 'es')+ end++ it { expect(page).to have_current_path(spree.product_path(product)) }+ end+ endendend