Is there any documentation on creating an order pr...
# support
v
Is there any documentation on creating an order programatically? I am integrating our POS and instead of using
Spree::StockMovement
I wanted to go through the entire order flow. This way the order also shows up when the user logs in or an admin needs to track something. Been looking at the specs, api and frontend controllers but I am having little success
e
you might want to see: core/lib/spree/testing_support/order_walkthrough.rb
v
Yeah I got there as well, but I am stuck at adding a line_item
I always get: ActiveRecord:RecordInvalid Validation failed: Price is not valid
e
how are you adding the line item to the ordre? using the order.contents.add ?
v
Yeah
order.contents.add( product, quantity )
Mmm
I initialized the order with a pricing_option
After removing it, it seems to work
e
is
product
a Spree::Variant instance ?
v
Yes, but I think it seems to work now
e
alright, yes, then there's an issue with your prices, make sure you have prices for the order currency, or even country iso
v
Ill check thanks!