fix add-to-cart button not submitting in shop mode
All checks were successful
deploy / deploy (push) Successful in 1m5s

The button type condition checked @mode == :live but ThemeHook sets
mode to :shop, so the button rendered as type="button" (doing nothing).
Changed to @mode == :preview to match the existing phx-click pattern.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
jamey 2026-02-24 22:58:41 +00:00
parent 0b0adba0fe
commit c0427d6956

View File

@ -1525,7 +1525,7 @@ defmodule BerrypodWeb.ShopComponents.Product do
~H""" ~H"""
<div class="atc-wrap" data-sticky={to_string(@sticky)}> <div class="atc-wrap" data-sticky={to_string(@sticky)}>
<button <button
type={if @mode == :live, do: "submit", else: "button"} type={if @mode == :preview, do: "button", else: "submit"}
phx-click={if @mode == :preview, do: open_cart_drawer_js()} phx-click={if @mode == :preview, do: open_cart_drawer_js()}
disabled={@disabled} disabled={@disabled}
class="atc-btn" class="atc-btn"