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
Code improvements.
Matthew Kennedy4198d2f72e27
diff --git a/api/app/controllers/spree/api/v2/storefront/wished_variants_controller.rb b/api/app/controllers/spree/api/v2/storefront/wished_variants_controller.rbindex df27ea8f9b..d04e1f516a 100644--- a/api/app/controllers/spree/api/v2/storefront/wished_variants_controller.rb+++ b/api/app/controllers/spree/api/v2/storefront/wished_variants_controller.rb@@ -10,7 +10,7 @@ module Spreewished_variant = Spree::WishedVariant.new(wished_variant_attributes)if wishlist.include? params[:wished_variant][:variant_id]- wished_variant = wishlist.wished_variants.detect { |wp| wp.variant_id == params[:wished_variant][:variant_id].to_i }+ wished_variant = wishlist.wished_variants.detect { |item| item.variant_id.to_s == params[:wished_product][:variant_id] }elsewished_variant.wishlist = wishlistwished_variant.savediff --git a/core/app/models/spree/wishlist.rb b/core/app/models/spree/wishlist.rbindex 2746c8a420..d94236163b 100644--- a/core/app/models/spree/wishlist.rb+++ b/core/app/models/spree/wishlist.rb@@ -4,8 +4,8 @@ module Spreehas_secure_token- belongs_to :user, class_name: Spree.user_class.to_s- belongs_to :store, class_name: 'Spree::Store', touch: true+ belongs_to :user, class_name: Spree.user_class.to_s, touch: true+ belongs_to :store, class_name: 'Spree::Store'has_many :wished_variants, class_name: 'Spree::WishedVariant', dependent: :destroy@@ -21,7 +21,7 @@ module Spreeenddef self.get_by_param(param)- find_by_token(param)+ find_by(token: param)enddef can_be_read_by?(user)