In spree commerce is there any way to get the stock location of the line items.
Asked
Active
Viewed 467 times
1 Answers
3
Firstly You can find you complete order let say you order number is R001023223 Then
order = Spree::Order.complete.find_by_number('R001023223')
then find line item as like this
For single line item stock location
line_item = order.line_items.first
stock_locations = line_item.variant.stock_locations
For all stock locations of line items:
stock_locations = order.variants.map(&:stock_locations).flatten
that's it...!!!

Vishal JAIN
- 1,940
- 1
- 11
- 14

milind phirake
- 493
- 3
- 8
-
1for all stock location for line items of given order i can editing in your post – Vishal JAIN Jul 01 '15 at 12:06