{% comment %} Option 4 - Cart Page: Sticky Banner A sticky banner displayed at the bottom of the cart whenever qualifying products are present, prompting the customer to add coverage with a single click. It can be dismissed without affecting cart items. Add this snippet at the BOTTOM of your cart items list, just before the order summary / checkout button block in your cart.liquid or sections/main-cart-items.liquid. Usage: {% render 'cart-sticky-banner' %} Requirements: - Cart items' parent products must have an `akko.plan` metafield (list of product references), matching the standard set by product-opt-in-modal. - The banner discovers the first available plan not yet in the cart and hides itself automatically when every plan is already present. --------------------------------------------------------------------------- REFERENCE EXAMPLE - adapt before use. Provided as a starting point and written against Shopify's Dawn theme. Markup, class names and styling will need adjusting to fit your own theme. Always test in a duplicated, unpublished theme before publishing. AKKO does not warrant this code as production-ready for any particular store. --------------------------------------------------------------------------- {% endcomment %} {% comment %} Discover the first available Akko plan not yet in the cart {% endcomment %} {% assign suggested_plan = null %} {% for item in cart.items %} {% if suggested_plan %}{% break %}{% endif %} {% assign item_plans = item.product.metafields.akko.plan.value %} {% if item_plans != blank %} {% for plan in item_plans %} {% if plan.available %} {% assign plan_in_cart = false %} {% for cart_item in cart.items %} {% if cart_item.product_id == plan.id %} {% assign plan_in_cart = true %} {% break %} {% endif %} {% endfor %} {% unless plan_in_cart %} {% assign suggested_plan = plan %} {% break %} {% endunless %} {% endif %} {% endfor %} {% endif %} {% endfor %} {% if suggested_plan %} {% assign first_variant = suggested_plan.selected_or_first_available_variant %}
{% endif %}