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
Keep the caller's order when adding products to a catalog
Damian Legawiece43d971533c9
diff --git a/spree/core/app/models/spree/catalog.rb b/spree/core/app/models/spree/catalog.rbindex 7d08e05fd8..15dd72d183 100644--- a/spree/core/app/models/spree/catalog.rb+++ b/spree/core/app/models/spree/catalog.rb@@ -97,8 +97,13 @@ module Spree# Scoped to this store's products, so an id from another tenant adds# nothing rather than being inserted past the row-level validation the- # bulk write skips.- new_ids = store.products.where(id: product_ids).ids - catalog_products.pluck(:product_id)+ # bulk write skips. The caller's order is what the positions are numbered+ # from, so the filtering keeps it — a database returns matching rows in+ # whatever order it likes.+ allowed_ids = store.products.where(id: product_ids).ids.to_set+ taken_ids = catalog_products.pluck(:product_id).to_set++ new_ids = product_ids.uniq.select { |id| allowed_ids.include?(id) && !taken_ids.include?(id) }return 0 if new_ids.empty?now = Time.currentdiff --git a/spree/providers/stripe/app/models/spree_stripe/gateway/payment_sessions.rb b/spree/providers/stripe/app/models/spree_stripe/gateway/payment_sessions.rbindex 1d8252ff7b..27d67b5761 100644--- a/spree/providers/stripe/app/models/spree_stripe/gateway/payment_sessions.rb+++ b/spree/providers/stripe/app/models/spree_stripe/gateway/payment_sessions.rb@@ -276,7 +276,7 @@ module SpreeStripe# Countries are reference data now, not records — addresses name one by# ISO code rather than holding a foreign key.- owner.bill_address ||= Spree::Address.new(country_code: country.iso, customer: owner.customer)+ owner.bill_address ||= Spree::Address.new(country_code: country.iso, owner: owner.customer)owner.bill_address.quick_checkout = true# Google Pay sometimes omits the name entirely.