mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-28 21:07:16 +00:00
Override in_stock? to prepare for Spree 2.0
This commit is contained in:
@@ -20,6 +20,14 @@ module OpenFoodNetwork
|
||||
Spree::Price.new(amount: price, currency: currency)
|
||||
end
|
||||
|
||||
# Old Spree has the same logic as here and doesn't need this override.
|
||||
# But we need this to use VariantOverrides with Spree 2.0.
|
||||
def in_stock?
|
||||
return true unless Spree::Config[:track_inventory_levels]
|
||||
|
||||
on_demand || (count_on_hand > 0)
|
||||
end
|
||||
|
||||
def count_on_hand
|
||||
@variant_override.andand.count_on_hand || super
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user