Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v4.3] Show "Unavailable" status for products with a future Available On date #5743

Merged
merged 2 commits into from
May 8, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Products that are not available shouldn't show Available status
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]>
(cherry picked from commit e404e44)
  • Loading branch information
forkata authored and tvdeyen committed May 8, 2024
commit 956319a424cc69f37789fc80b491a73a1b076402
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'