make PDP variant selection work without JS
All checks were successful
deploy / deploy (push) Successful in 1m3s
All checks were successful
deploy / deploy (push) Successful in 1m3s
Variant options (colour, size) are now URL params handled via handle_params instead of phx-click events. Swatches and size buttons render as patch links in shop mode, so changing variants works as plain navigation without JS. Quantity is now a number input that submits with the form. Unavailable variants render as disabled spans. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -32,7 +32,7 @@
|
||||
name="variant_id"
|
||||
value={@selected_variant && @selected_variant.id}
|
||||
/>
|
||||
<input type="hidden" name="quantity" value={@quantity} />
|
||||
<%!-- quantity is provided by the quantity_selector input below --%>
|
||||
|
||||
<%!-- Dynamic variant selectors --%>
|
||||
<%= for option_type <- @option_types do %>
|
||||
@@ -41,6 +41,7 @@
|
||||
selected={@selected_options[option_type.name]}
|
||||
available={@available_options[option_type.name] || []}
|
||||
mode={@mode}
|
||||
option_urls={(@option_urls || %{})[option_type.name] || %{}}
|
||||
/>
|
||||
<% end %>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user