Method: Spree::Product#available?

Defined in:
app/models/spree/product.rb

#available?Boolean

Determines if product is available. A product is available if it has not been deleted, the available_on date is in the past and the discontinue_on date is nil or in the future.

Returns:

  • (Boolean)

    true if this product is available



177
178
179
# File 'app/models/spree/product.rb', line 177

def available?
  !deleted? && available_on&.past? && !discontinued?
end