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.

Assign all products to all Stores in Samples

Damian Legawiecafade112a893
diff --git a/sample/db/samples/stores.rb b/sample/db/samples/stores.rb
index 5966ec2a98..b8fa63a047 100644
--- a/sample/db/samples/stores.rb
+++ b/sample/db/samples/stores.rb
@@ -43,3 +43,10 @@ end
Spree::PaymentMethod.all.each do |payment_method|
payment_method.stores = Spree::Store.all
end
+
+if defined?(Spree::StoreProduct) && Spree::Product.method_defined?(:stores)
+ Spree::Product.all.each do |product|
+ product.store_ids = Spree::Store.ids
+ product.save
+ end
+end