{% comment %} Option 2 - Product Page: Inline Toggle A "Protect Your Purchase" card rendered directly on the product page, below the price and above the Add to Cart / Buy it Now buttons. The customer uses a toggle to opt in or out before adding to cart, with no modal interruption. REPLACES the theme's buy-buttons section. Render it in place of your buy-buttons snippet, e.g. in sections/main-product.liquid instead of the default {% render 'buy-buttons' %}. Usage: {% render 'product-inline-toggle', product: product, block: block, product_form_id: product_form_id, section_id: section.id %} Requirements: - `product`: the product being purchased. Protection plans are discovered via the `akko.plan` metafield (list of product references), matching the standard set by product-opt-in-modal. - `block`: the block object (for shopify_attributes). - `product_form_id`: the product form id string. - `section_id`: passed through so IDs stay unique if the section renders multiple times. --------------------------------------------------------------------------- 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 %} {%- liquid assign plan_list = product.metafields.akko.plan.value assign has_plans = false if plan_list != blank and plan_list.size > 0 assign has_plans = true endif assign check_against_inventory = true if product.selected_or_first_available_variant.inventory_management != 'shopify' or product.selected_or_first_available_variant.inventory_policy == 'continue' assign check_against_inventory = false endif assign quantity_rule_soldout = false if product.selected_or_first_available_variant.quantity_rule.min > product.selected_or_first_available_variant.inventory_quantity and check_against_inventory assign quantity_rule_soldout = true endif assign variant_available = true if product.selected_or_first_available_variant.available == false or quantity_rule_soldout or product.selected_or_first_available_variant == null assign variant_available = false endif -%}