add contextual prompts for skipped setup steps
All checks were successful
deploy / deploy (push) Successful in 1m26s

Disable checkout when Stripe isn't connected (cart drawer, cart page,
and early guard in checkout controller to prevent orphaned orders).
Show amber warning on order detail when email isn't configured.
Fix pre-existing missing vertical spacing between page blocks.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
jamey
2026-03-04 14:02:49 +00:00
parent 005ebca432
commit 67a26eb6b4
10 changed files with 122 additions and 53 deletions

View File

@@ -1,23 +1,29 @@
defmodule BerrypodWeb.CheckoutController do
use BerrypodWeb, :controller
alias Berrypod.{Analytics, Cart}
alias Berrypod.{Analytics, Cart, Settings}
alias Berrypod.Orders
alias Berrypod.Shipping
require Logger
def create(conn, _params) do
cart_items = Cart.get_from_session(get_session(conn))
hydrated = Cart.hydrate(cart_items)
if hydrated == [] do
unless Settings.has_secret?("stripe_api_key") do
conn
|> put_flash(:error, "Your basket is empty")
|> put_flash(:error, "Checkout isn't available yet")
|> redirect(to: ~p"/cart")
else
track_checkout_start(conn)
create_checkout(conn, hydrated)
cart_items = Cart.get_from_session(get_session(conn))
hydrated = Cart.hydrate(cart_items)
if hydrated == [] do
conn
|> put_flash(:error, "Your basket is empty")
|> redirect(to: ~p"/cart")
else
track_checkout_start(conn)
create_checkout(conn, hydrated)
end
end
end