Show all spree ecommerce products together with th

2019-05-29 09:59发布

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

1条回答
淡お忘
2楼-- · 2019-05-29 10:49

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).

查看更多
登录 后发表回答