1

How can I show all products and their counts together in one place in Spree Commerce? The only place I see the count_on_hand implemented is in admin/stock_transfers and even then it's several clicks deep for the administrator.

 admin --> configuration --> stock transfers --> view transfer

and then you can see a count on hand variable displayed per item.

enter image description here

andrew
  • 9,313
  • 7
  • 30
  • 61
Wolfish
  • 13
  • 3

1 Answers1

1

Each product has a total on hand method defined here:

https://github.com/spree/spree/blob/v2.2.2/core/app/models/spree/product.rb#L200-L206

You can iterate through all products, and call total_on_hand to find the number of those products on hand (for all variants and stock locations).

gmacdougall
  • 4,901
  • 1
  • 16
  • 21