Skip to content

Commit

Permalink
Products that are not available shouldn't show Available status
Browse files Browse the repository at this point in the history
Currently if a product has the `available_on` date in the future, it
will still show a status of Available, even though it is not available
for purchase on the store. This change proposes a new status of
`Unavailable` for scheduled products.

Co-authored-by: Harmony Bouvier <[email protected]>
  • Loading branch information
forkata and harmonymjb committed May 1, 2024
1 parent eda3961 commit e404e44
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ class SolidusAdmin::Products::Status::Component < SolidusAdmin::BaseComponent
available: :green,
discontinued: :yellow,
deleted: :red,
unavailable: :yellow
}.freeze

def self.from_product(product)
Expand All @@ -13,8 +14,10 @@ def self.from_product(product)
:deleted
elsif product.discontinued?
:discontinued
else
elsif product.available?
:available
else
:unavailable
end

new(status: status)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ en:
available: 'Available'
discontinued: 'Discontinued'
deleted: 'Deleted'
unavailable: 'Unavailable'

0 comments on commit e404e44

Please sign in to comment.