How to get stock location for item from full order in syringe trade?

There is some way in spree commerce to get the position of positions in positions.

+4
source share
1 answer

Firstly, you can find the full order if you want to indicate the order number: R001023223 Then

order = Spree::Order.complete.find_by_number('R001023223')

then find a position like this.

For position position of line item

line_item = order.line_items.first
stock_locations = line_item.variant.stock_locations

For all position placements:

stock_locations = order.variants.map(&:stock_locations).flatten

what he...!!!

+3
source

All Articles