Skip to content

armgit / spree

Public Imported from GitHub
0

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.

fix FrontendHelper#available_option_types

Łukasz Adamczykdc9f8aa82195
diff --git a/frontend/app/helpers/spree/frontend_helper.rb b/frontend/app/helpers/spree/frontend_helper.rb
index ae52280780..e2d39dbd04 100644
--- a/frontend/app/helpers/spree/frontend_helper.rb
+++ b/frontend/app/helpers/spree/frontend_helper.rb
@@ -300,10 +300,15 @@ module Spree
def available_option_types
@available_option_types ||= Rails.cache.fetch("available-option-types/#{available_option_types_cache_key}") do
# TODO: extract this to a finder
- products_scope = Product.active(current_currency).in_taxon(@taxon)
+ products_scope = Product.active(current_currency)
+
+ if @taxon.present?
+ products_scope = products_scope.in_taxon(@taxon)
+ end
+
option_values = OptionValues::FindFilterable.new(products_scope: products_scope).execute
- Filters::Options.new(option_values: option_values).to_a
+ Filters::Options.new(option_values_scope: option_values).to_a
end
@available_option_types
end