prevent checkout with unavailable product variants
- Include is_available flag in hydrated cart items - Show unavailable message on cart items and product page - Block add-to-cart for unavailable variants - Redirect back to cart with error if checkout has unavailable items Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -553,7 +553,18 @@ defmodule BerrypodWeb.PageRenderer do
|
||||
</div>
|
||||
|
||||
<.quantity_selector quantity={assigns[:quantity] || 1} in_stock={@product.in_stock} />
|
||||
<.add_to_cart_button mode={@mode} />
|
||||
|
||||
<p
|
||||
:if={assigns[:selected_variant] && !assigns[:selected_variant].is_available}
|
||||
class="variant-unavailable-msg"
|
||||
>
|
||||
This option is currently unavailable
|
||||
</p>
|
||||
|
||||
<.add_to_cart_button
|
||||
mode={@mode}
|
||||
disabled={assigns[:selected_variant] && !assigns[:selected_variant].is_available}
|
||||
/>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user