{% comment %} Option 3 - Cart Page: Per-Product Checkbox Renders a checkbox row beneath each cart line item that has an AKKO plan associated via metafields, with the price delta shown inline. When checked, the protection plan is added as a separate line item. Outputs a so it works inside Dawn's cart . Usage (inside the {% for item in cart.items %} loop, after the ): {% render 'cart-per-product-checkbox', item: item, loop_index: forloop.index %} Requirements: - `item`: the current cart line item object. - `loop_index`: forloop.index - keeps IDs unique per row. - Products without the `akko.plan` metafield are skipped automatically. --------------------------------------------------------------------------- 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 %} {% assign item_plan_list = item.product.metafields.akko.plan.value %} {% if item_plan_list != blank and item_plan_list.size > 0 %} {% assign protection_plan = item_plan_list | first %} {% if protection_plan != blank and protection_plan.available %} {% assign protection_variant = protection_plan.selected_or_first_available_variant %} {% if protection_variant != blank %} {% assign plan_already_in_cart = false %} {% for ci in cart.items %} {% if ci.variant_id == protection_variant.id %} {% assign plan_already_in_cart = true %} {% assign plan_line_key = ci.key %} {% break %} {% endif %} {% endfor %} {% endif %} {% endif %} {% endif %}
Add {{ protection_plan.title }} {{ protection_plan.description | strip_html | truncate: 80 }}
+{{ protection_variant.price | money }}