You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The cause of this bug was that the stock_items association defined on the Product model was only fetching stock items for variants of that product that weren't the master variant. If the master variant is the only variant of this product, then no stock items at all were being returned.
I have submitted a fix for it to my 2-0-stable, 2-1-stable and master branches.
Since Spree 2.1.1,
product.stock_items.first.adjust_count_on_hand(10)
throws the errorundefined method
adjust_count_on_hand' for nil:NilClass`.Changing to
product.master.stock_items.first.adjust_count_on_hand(10)
fixes it.@radar said: In
product.rb
,has_many :stock_items, through: :variants
, rather thanhas_many :stock_items, through: :variants_including_master
.The text was updated successfully, but these errors were encountered: