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 orders sample

Łukasz Adamczyk3cf4463a518f
diff --git a/sample/db/samples/orders.rb b/sample/db/samples/orders.rb
index 07a3d2a2d7..c09bfb0557 100644
--- a/sample/db/samples/orders.rb
+++ b/sample/db/samples/orders.rb
@@ -12,9 +12,9 @@ orders << store.orders.where(
currency: 'USD'
).first_or_create! do |order|
- order.item_total = product_1.master.amount_in(order.currency)
- order.adjustment_total = product_1.master.amount_in(order.currency)
- order.total = product_1.master.amount_in(order.currency) * 2
+ order.item_total = product_1.default_variant.amount_in(order.currency)
+ order.adjustment_total = product_1.default_variant.amount_in(order.currency)
+ order.total = product_1.default_variant.amount_in(order.currency) * 2
end
orders << store.orders.where(
@@ -22,26 +22,26 @@ orders << store.orders.where(
currency: 'USD'
).first_or_create! do |order|
- order.item_total = product_2.master.amount_in(order.currency)
- order.adjustment_total = product_2.master.amount_in(order.currency)
- order.total = product_2.master.amount_in(order.currency) * 2
+ order.item_total = product_2.default_variant.amount_in(order.currency)
+ order.adjustment_total = product_2.default_variant.amount_in(order.currency)
+ order.total = product_2.default_variant.amount_in(order.currency) * 2
order.shipping_address = Spree::Address.first
order.billing_address = Spree::Address.last
end
unless orders[0].line_items.any?
orders[0].line_items.new(
- variant: product_1.master,
+ variant: product_1.default_variant,
quantity: 1,
- price: product_1.master.amount_in(orders[0].currency)
+ price: product_1.default_variant.amount_in(orders[0].currency)
).save!
end
unless orders[1].line_items.any?
orders[1].line_items.new(
- variant: product_2.master,
+ variant: product_2.default_variant,
quantity: 1,
- price: product_1.master.amount_in(orders[1].currency)
+ price: product_1.default_variant.amount_in(orders[1].currency)
).save!
end