diff --git a/assets/css/shop/components.css b/assets/css/shop/components.css index 4212cbb..36a8d04 100644 --- a/assets/css/shop/components.css +++ b/assets/css/shop/components.css @@ -781,6 +781,15 @@ font-weight: 600; } + /* ── Unavailable message ── */ + + .variant-unavailable-msg { + color: var(--t-sale-color); + font-size: var(--t-text-small); + font-weight: 500; + margin-bottom: 1rem; + } + /* ── Add to cart ── */ .atc-wrap { @@ -1709,6 +1718,13 @@ margin: 0; } + .cart-item-unavailable { + font-size: var(--t-text-caption); + color: var(--t-sale-color); + font-weight: 500; + margin: 0.25rem 0 0; + } + .cart-item-actions { display: flex; justify-content: space-between; diff --git a/lib/berrypod/cart.ex b/lib/berrypod/cart.ex index eea0477..76a5217 100644 --- a/lib/berrypod/cart.ex +++ b/lib/berrypod/cart.ex @@ -132,7 +132,8 @@ defmodule Berrypod.Cart do variant: format_variant_options(variant.options), price: variant.price, quantity: quantity, - image: variant_image_url(variant.product) + image: variant_image_url(variant.product), + is_available: variant.is_available } end end) diff --git a/lib/berrypod_web/components/shop_components/cart.ex b/lib/berrypod_web/components/shop_components/cart.ex index a5b4146..9f47ecb 100644 --- a/lib/berrypod_web/components/shop_components/cart.ex +++ b/lib/berrypod_web/components/shop_components/cart.ex @@ -212,6 +212,10 @@ defmodule BerrypodWeb.ShopComponents.Cart do
<% end %> ++ This item is currently unavailable +
++ This option is currently unavailable +
+ + <.add_to_cart_button + mode={@mode} + disabled={assigns[:selected_variant] && !assigns[:selected_variant].is_available} + />