diff --git a/lib/tasks/sample_data/product_factory.rb b/lib/tasks/sample_data/product_factory.rb index ba2bbfa208..117f25b2e3 100644 --- a/lib/tasks/sample_data/product_factory.rb +++ b/lib/tasks/sample_data/product_factory.rb @@ -74,8 +74,10 @@ class ProductFactory variant_unit: "weight", variant_unit_scale: 1, unit_value: 1, - on_demand: true + shipping_category: Spree::ShippingCategory.find_or_create_by_name('Default') ) - Spree::Product.create_with(params).find_or_create_by_name!(params[:name]) + product = Spree::Product.create_with(params).find_or_create_by_name!(params[:name]) + product.variants.first.update_attribute :on_demand, true + product end end diff --git a/lib/tasks/sample_data/shipping_method_factory.rb b/lib/tasks/sample_data/shipping_method_factory.rb index 87e3747781..1e05109210 100644 --- a/lib/tasks/sample_data/shipping_method_factory.rb +++ b/lib/tasks/sample_data/shipping_method_factory.rb @@ -47,7 +47,8 @@ class ShippingMethodFactory def create_shipping_method(enterprise, params) params[:distributor_ids] = [enterprise.id] method = enterprise.shipping_methods.new(params) - method.zone = zone + method.zones << zone + method.shipping_categories << Spree::ShippingCategory.find_or_create_by_name('Default') method.save! method end