<div class="cart-drawer-content" {% render 'overwrite-theme-style', background_color: section.settings.overwrite_theme_background_color, overwrite_drawer_mobile_width: section.settings.overwrite_drawer_mobile_width %} data-item-count="{{ cart.item_count }}">

    <div class="cart-drawer-header">
        <h2 {% render 'overwrite-theme-style', text_color: section.settings.overwrite_theme_text_color %}>{{ 'cart.title' | t }}</h2>
        <div class="cart-drawer-header-close-icon no-click-highlight" style="--cart-drawer-header-close-icon-color: {{ section.settings.icon_color | color_to_hex }};">{% render 'icon-close' %}</div>
    </div>

    <div class="cart-drawer-contents container" {%- if cart.item_count == 0 -%}style="display: none;"{%- endif -%}>

    {%- for block in section.blocks -%}
    {% case block.type %}
        
        {%- when '@app' -%}
            {% render block %}
        {% when "shipping_info" %}
            {%- capture style -%}
                --cart-drawer-shipping-header-checkmark-color: {{ block.settings.overwrite_theme_text_color | color_to_hex }};
            {%- endcapture -%}

            <div class="ccpc ccpc-display cart-drawer-shipping-header" {% render 'overwrite-theme-style', settings: block.settings, append_style: style %}>
                {%- assign delivery = "" -%}
                {%- if block.settings.days_until_arrive != blank and block.settings.days_until_arrive != 0 -%}
                    {% assign seconds = block.settings.days_until_arrive | times: 86400 %}

                    {%- if block.settings.exclude_sundays -%}
                        {% assign now_week_day = 'now' | date: "%w" | plus: 0 %}
                        {% assign deliver_week_day = 'now' | date: "%s" | plus: seconds | date: "%w" | plus: 0 %}
                        {%- if now_week_day > deliver_week_day -%}
                            {% assign seconds = seconds | plus: 86400 %}
                        {%- endif -%}
                    {%- endif -%}

                    {%- capture date_format -%}
                        {%- case block.settings.display_format -%}
                            {%- when 'day' -%}
                                {{ 'cart.shipping_headline_delivery_date_format_weekday' | t }}
                            {%- when 'day_month' -%}
                                {{ 'cart.shipping_headline_delivery_date_format_day_month' | t }}
                            {%- when 'day_month_year' -%}
                                {{ 'cart.shipping_headline_delivery_date_format_day_month_year' | t }}
                        {%- endcase -%}
                    {%- endcapture -%}
                    {%- capture delivery -%}
                        {%- if date_format contains "A" -%}
                            {% assign printing_week_key =  'now' | date: "%s" | plus: seconds | date: "%w" %}
                            {{ 'cart.delivery_day_' | append: printing_week_key | t }}
                        {%- else -%}
                            {{ 'now' | date: "%s" | plus: seconds | date: date_format }}
                        {%- endif -%}
                    {%- endcapture -%}
                {%- endif -%}
                
                {% render 'icon-checkmark' %}
                <div>
                    {%- if block.settings.days_until_arrive != blank and block.settings.days_until_arrive != 0 -%}
                        {{ 'cart.shipping_headline_delivery_html' | t: delivery: delivery | strip_newlines | strip }}
                    {%- else -%}
                        {{ 'cart.shipping_headline' | t }}
                    {%- endif -%}
                </div>
            </div>

        {% when "cart_items" %}
            {% comment %} Display free as price, editing items {% endcomment %}
            {% assign cart_item_property_key = 'cart.cart_item_property_key' | t %}
            {% assign cart_item_property_value = 'cart.cart_item_property_value' | t %}
            {% assign display_free = false%}
            {% assign hide_editing = false %}
            {% assign auto_product = false %}
            {%- for block in section.blocks -%}
            {% case block.type %}
                {%- when "add_product_automatically" -%}
                    {% if block.settings.trigger_product != blank and block.settings.product_to_add != blank %}
                        {% assign auto_product = true %}
                    {% endif %}
                    {% if block.settings.free_price == true %}
                        {% assign display_free = true %}
                    {% endif %}
                    {% if block.settings.hide_trash_icon_and_quantity == true %}
                        {% assign hide_editing = true %}
                    {% endif %}
            {%- endcase -%}
            {% endfor %}

            {% comment %} ===== Handle bundle discount ===== {% endcomment %}
            {%- liquid
                assign bundle_discount_detected = false
                assign bundle_first_item = blank
                assign bundle_second_item = blank


                if section.settings.bundle_discount_name != blank
                for item in cart.items
                    for discount_allocation in item.line_level_discount_allocations
                        if discount_allocation.discount_application.title == section.settings.bundle_discount_name
                            if discount_allocation.amount == 0
                                assign bundle_first_item = item
                            else
                                assign bundle_second_item = item
                            endif
                            break
                        endif
                    endfor
                endfor
                endif


                if bundle_first_item != blank and bundle_second_item != blank
                    assign bundle_discount_detected = true
                    assign bundle_total = bundle_first_item.original_line_price | plus: bundle_second_item.original_line_price
                    assign bundle_discounted_total = bundle_first_item.original_line_price

                    if section.settings.bundle_discount_type == 'percentage'
                        assign discount_value = section.settings.bundle_discount_value
                        if discount_value > 100
                            assign discount_value = 100
                        endif

                        assign percentage = 100 | minus: discount_value
                        assign percentage = percentage | divided_by: 100.0
                        assign second_price = bundle_second_item.original_line_price | times: percentage | floor

                        assign bundle_discounted_total = bundle_discounted_total | plus: second_price
                    else
                        assign second_price = bundle_second_item.original_line_price | minus: section.settings.bundle_discount_value
                        assign bundle_discounted_total = bundle_discounted_total | plus: second_price
                    endif

                    assign bundle_discount_percentage = bundle_discounted_total | times: 1.0 | divided_by: bundle_total
                endif
            %}
            {% comment %} ===== End Handle bundle discount ===== {% endcomment %}

            {%- capture image_width_style -%}
                --cart-drawer-item-image-desktop-width: {{ block.settings.image_width_desktop }}%;
                --cart-drawer-item-image-mobile-width: {{ block.settings.image_width_mobile }}%;
            {%- endcapture -%}

            {%- capture price_style -%}
                {%- if block.settings.price_color != blank -%}
                    {%- assign alpha = block.settings.price_color | color_extract: 'alpha' -%}

                    {%- if alpha == 1 -%}
                        --cart-drawer-price-color: {{ block.settings.price_color | color_to_hex }}; 
                    {%- endif -%}
                {%- endif -%}
            {%- endcapture -%}

            <div class="cart-drawer-items" {% render 'overwrite-theme-style', settings: block.settings, append_style: price_style %}>
                {% assign set_free_products_handled_count = 0 %}
                {% assign set_free_products_handled = false %}

                {% for item in cart.items %}
                    <div class="cart-drawer-item" style="{{ image_width_style | strip_newlines }}">
                        {% render 'image', image: item.image, class: 'cart-drawer-item-image' %}
                        <div class="cart-drawer-item-data" {% if auto_product == true %} trigger-product-cart="{{item.product_id}}" added-product-cart="{{item.variant_id}}" {% endif %} {% render 'overwrite-theme-style', text_color: block.settings.overwrite_theme_text_color, font_size: block.settings.text_font_size %}>
                            {% if block.settings.clickable_title %}    
                                <a class="cart-drawer-item-data-title" href="{{ item.product.url }}">
                            {% endif %}
                                    <h3 {% render 'overwrite-theme-style', text_color: block.settings.overwrite_theme_text_color, font_size: block.settings.heading_font_size %}>{{ item.product.title | escape }}</h3>
                            {% if block.settings.clickable_title %}  
                                </a>
                            {% endif %}
                            
                            {%- if block.settings.show_info_text -%}
                                <div class="cart-drawer-item-option-info">
                                    {% if block.settings.info_text_metafield_name != blank %}
                                        {% assign metafield_brackets = block.settings.info_text_metafield_name | split: "." %}
                                        {% assign metafield_brackets_size = metafield_brackets | size %}
                    
                                        {% if metafield_brackets_size < 2 %}
                                            {{ item.product.metafields[metafield_brackets[0]] | strip }}
                                        {% else if metafield_brackets_size == 2 %}
                                            {{ item.product.metafields[metafield_brackets[0]][metafield_brackets[1]] | strip }}
                                        {% endif %}

                                        <script>
                                            var cr_products_info_text_metafields = {};

                                            {% for the_product in collections['all'].products %}
                                                {% if metafield_brackets_size < 2 %}
                                                    cr_products_info_text_metafields[{{- the_product.id -}}] = "{{ the_product.metafields[metafield_brackets[0]] | strip }}";
                                                {% else if metafield_brackets_size == 2 %}
                                                    cr_products_info_text_metafields[{{- the_product.id -}}] = "{{ the_product.metafields[metafield_brackets[0]][metafield_brackets[1]] | strip }}";
                                                {% endif %}
                                            {% endfor %}
                                        </script>
                                    {% else %}
                                        {{ 'cart.info_text' | t }}
                                    {% endif %}
                                </div>
                            {%- endif -%}

                            <div class="cart-drawer-item-options">
                            {%- if item.product.has_only_default_variant == false and block.settings.variant_display_type != 'none' -%}
                                {%- if block.settings.variant_display_type == 'options' -%}
                                    {%- for option in item.options_with_values -%}
                                        <div class="cart-drawer-item-option">
                                            <span>{{ option.name }}:</span> {{ option.value }}
                                        </div>
                                    {%- endfor -%}
                                {%- else -%}
                                    <div class="cart-drawer-item-option">
                                        <span>
                                        {%- for option in item.options_with_values -%}
                                            {{ option.value }}
                                            {% unless forloop.last %} / {% endunless %}
                                        {%- endfor -%}
                                        </span>
                                    </div>
                                {%- endif -%}
                            {%- endif -%}
                            </div>
            
                            <div class="cart-drawer-item-properties">
                            {%- for property in item.properties -%}
                                {%- assign property_first_char = property.first | slice: 0 -%}
                                {%- assign property_last_char = 'cart.cart_item_property_value' | t -%}
                                {%- if property.last != blank and property_first_char != '_' and property.last != property_last_char -%}
                                    <div class="cart-drawer-item-option">
                                        <span>{{ property.first }}: </span>
                                    
                                        {%- if property.last contains '/uploads/' -%}
                                            <a href="{{ property.last }}" target="_blank">
                                                {{ 'cart.file' | t }}
                                            </a>
                                        {%- else -%}
                                            {{ property.last }}
                                        {%- endif -%}
                                    </div>
                                {%- endif -%}
                            {%- endfor -%}
                            </div>
            
                            <div class="cart-drawer-item-price font-heading">
                                {% assign is_bundle_first_item = false %}
                                {% assign is_bundle_second_item = false %}

                                {% if bundle_discount_detected and item.line_level_discount_allocations.size > 0 %}
                                {% for discount_allocation in item.line_level_discount_allocations %}
                                    {% if discount_allocation.discount_application.title == section.settings.bundle_discount_name %}
                                        {% if discount_allocation.amount == 0 %}
                                            {% assign is_bundle_first_item = true %}
                                        {% else %}
                                            {% assign is_bundle_second_item = true %}
                                        {% endif %}
                                        {% break %}
                                    {% endif %}
                                {% endfor %}
                                {% endif %}

                                {% if is_bundle_first_item or is_bundle_second_item %}
                                    {% assign force_compare_price = item.original_line_price | times: bundle_discount_percentage %}

                                    {% render 'price', price: force_compare_price, force_compare_price: item.original_line_price, show_compare_price: true, display_free: display_free, cart_item_property_key: cart_item_property_key, cart_item_property_value: cart_item_property_value %}
                                {% else %}
                                    {% comment %} Discounts / Sets {% endcomment %}
                                    {% if section.settings.show_discounts and item.line_level_discount_allocations.size > 0 and item.line_level_discount_allocations[0].discount_application.title == section.settings.set_discount_name %}
                                        {% comment %} Quantity equals free products {% endcomment %}
                                        {% if item.quantity == section.settings.set_product_count %}
                                            {% assign set_quantity = item.quantity | minus: section.settings.set_free_product_count %}
                                            {% assign set_compare_price = item.variant.compare_at_price | times: set_quantity %}

                                            {% render 'price', price: item.final_line_price, force_compare_price: set_compare_price, show_compare_price: true, display_free: display_free, cart_item_property_key: cart_item_property_key, cart_item_property_value: cart_item_property_value %}
                                            {% comment %} {% render 'price', cart_item: item, show_compare_price: true %} {% endcomment %}
                                        {% elsif item.quantity <= section.settings.set_free_product_count and set_free_products_handled == false %}
                                            {% assign set_free_products_handled_count = set_free_products_handled_count | plus: item.quantity %}

                                            {% if set_free_products_handled_count == section.settings.set_free_product_count %}
                                                {% assign set_free_products_handled = true %}
                                            {% endif %}

                                            {{ 'cart.free' | t }}
                                        {% elsif item.quantity > section.settings.set_free_product_count and set_free_products_handled == false %}
                                            {% assign set_free_products_handled = true %}

                                            {% assign remaining_quantity = item.quantity | minus: section.settings.set_free_product_count %}
                                            {% assign set_compare_price = item.variant.compare_at_price | times: remaining_quantity %}
                                            {% assign price = item.original_line_price %}

                                            {% if section.settings.set_discount_product_price != blank %}
                                                {% assign price = section.settings.set_discount_product_price | times: remaining_quantity %}
                                            {% endif %}

                                            {% render 'price', price: price, force_compare_price: set_compare_price, show_compare_price: true, display_free: display_free, cart_item_property_key: cart_item_property_key, cart_item_property_value: cart_item_property_value %}
                                        {% else %}
                                            {% assign set_compare_price = item.variant.compare_at_price | times: item.quantity %}
                                            {% assign set_show_compare_price = true %}
                                            {% assign price = item.original_line_price %}

                                            {% if set_compare_price == item.original_line_price %}
                                                {% assign set_show_compare_price = false %}
                                                {% assign set_compare_price = blank %}
                                            {% endif %}

                                            {% if section.settings.set_discount_product_price != blank %}
                                                {% assign price = section.settings.set_discount_product_price | times: item.quantity %}
                                            {% endif %}

                                            {% render 'price', price: price, force_compare_price: set_compare_price, show_compare_price: set_show_compare_price, display_free: display_free, cart_item_property_key: cart_item_property_key, cart_item_property_value: cart_item_property_value %}
                                        {% endif %}
                                    {% elsif section.settings.show_discounts and item.line_level_discount_allocations.size > 0 and item.line_level_discount_allocations[0].discount_application.title == section.settings.set_discount_name_2 %}
                                        {% comment %} Quantity equals free products {% endcomment %}
                                        {% if item.quantity == section.settings.set_product_count_2 %}
                                            {% assign set_quantity = item.quantity | minus: section.settings.set_free_product_count_2 %}
                                            {% assign set_compare_price = item.variant.compare_at_price | times: set_quantity %}

                                            {% render 'price', price: item.final_line_price, force_compare_price: set_compare_price, show_compare_price: true, display_free: display_free, cart_item_property_key: cart_item_property_key, cart_item_property_value: cart_item_property_value %}
                                            {% comment %} {% render 'price', cart_item: item, show_compare_price: true %} {% endcomment %}
                                        {% elsif item.quantity <= section.settings.set_free_product_count_2 and set_free_products_handled == false %}
                                            {% assign set_free_products_handled_count = set_free_products_handled_count | plus: item.quantity %}

                                            {% if set_free_products_handled_count == section.settings.set_free_product_count_2 %}
                                                {% assign set_free_products_handled = true %}
                                            {% endif %}

                                            {{ 'cart.free' | t }}
                                        {% elsif item.quantity > section.settings.set_free_product_count_2 and set_free_products_handled == false %}
                                            {% assign set_free_products_handled = true %}

                                            {% assign remaining_quantity = item.quantity | minus: section.settings.set_free_product_count_2 %}
                                            {% assign set_compare_price = item.variant.compare_at_price | times: remaining_quantity %}
                                            {% assign price = item.original_line_price %}

                                            {% if section.settings.set_discount_product_price_2 != blank %}
                                                {% assign price = section.settings.set_discount_product_price_2 | times: remaining_quantity %}
                                            {% endif %}

                                            {% render 'price', price: price, force_compare_price: set_compare_price, show_compare_price: true, display_free: display_free, cart_item_property_key: cart_item_property_key, cart_item_property_value: cart_item_property_value %}
                                        {% else %}
                                            {% assign set_compare_price = item.variant.compare_at_price | times: item.quantity %}
                                            {% assign set_show_compare_price = true %}
                                            {% assign price = item.original_line_price %}

                                            {% if set_compare_price == item.original_line_price %}
                                                {% assign set_show_compare_price = false %}
                                                {% assign set_compare_price = blank %}
                                            {% endif %}

                                            {% if section.settings.set_discount_product_price_2 != blank %}
                                                {% assign price = section.settings.set_discount_product_price_2 | times: item.quantity %}
                                            {% endif %}

                                            {% render 'price', price: price, force_compare_price: set_compare_price, show_compare_price: set_show_compare_price, display_free: display_free, cart_item_property_key: cart_item_property_key, cart_item_property_value: cart_item_property_value %}
                                        {% endif %}
                                    {% else %}
                                        {% comment %} Normal listings {% endcomment %}
                                        {% render 'price', cart_item: item, show_compare_price: true, display_free: display_free, cart_item_property_key: cart_item_property_key, cart_item_property_value: cart_item_property_value %}
                                    {% endif %}
                                {% endif %}
                            </div>

                            {% if section.settings.show_discounts and item.line_level_discount_allocations.size > 0 %}
                            {% for discount_allocation in item.line_level_discount_allocations %}
                                <div class="cart-drawer-item-discount" style="color: {{ section.settings.discount_color }};">
                                    {% render 'icon-discount', fill: section.settings.discount_color %}
                                    <div>
                                        <span class="cart-drawer-item-discount-title">{{ discount_allocation.discount_application.title }}</span>

                                        {% if bundle_discount_detected and discount_allocation.discount_application.title == section.settings.bundle_discount_name %}
                                            {%- liquid
                                                assign percentage = bundle_discounted_total | times: 1.0 | divided_by: bundle_total
                                                assign percentage = percentage | times: 100
                                                assign percentage = 100 | minus: percentage | floor
                                            -%}

                                            -{{ percentage }}%
                                        {% else %}
                                            {% assign render_discount_price = true %}
                                            {% if discount_allocation.discount_application.title == section.settings.set_discount_name or discount_allocation.discount_application.title == section.settings.set_discount_name_2 %}
                                                {% assign render_discount_price = false %}
                                            {% endif %}

                                            {% if render_discount_price %}
                                                {%- assign total_allocated_amount = discount_allocation.amount | times: -1 -%}
                                                {% render 'price', price: total_allocated_amount %}                                            
                                            {% endif %}
                                        {% endif %}
                                    </div>
                                </div>
                            {% endfor %}
                            {% endif %}

                            {% assign last_result_display = true %}
                            {% if hide_editing == true %}
                                {% if item.properties[cart_item_property_key] == cart_item_property_value %}
                                    {% assign last_result_display = false %}
                                {% else %}
                                    {% assign last_result_display = true %}
                                {% endif %}
                            {% endif %}
            
                            <div class="cart-drawer-item-editing"{%- if last_result_display == false -%}style="display: none;" {% else %} {%- if block.settings.show_quantity_field == false and block.settings.show_remove_button == false -%}style="display: none;"{%- endif -%} {%- endif -%}>
                                <div class="cart-drawer-item-quantity" {%- if block.settings.show_quantity_field == false -%}style="display: none;"{%- endif -%}>
                                    <button class="cart-drawer-item-quantity-minus" name="minus" type="button" data-line-index="{{ item.index | plus: 1 }}">{% render 'icon-minus' %}</button>
                                    <input id="cart-drawer-item-quantity-input-{{ item.index | plus: 1 }}" class="font-button" name="quantity" min="1" value="{{ item.quantity }}" disabled>
                                    <button class="cart-drawer-item-quantity-plus" name="plus" type="button" data-line-index="{{ item.index | plus: 1 }}" {%- if item.variant.inventory_management == 'shopify' -%} data-stock="{{- item.variant.inventory_quantity -}}"{%- endif -%}>{% render 'icon-plus' %}</button>
                                </div>

                                <div class="cart-drawer-item-remove" data-line-index="{{ item.index | plus: 1 }}" {%- if block.settings.show_remove_button == false -%}style="display: none;"{%- endif -%}>
                                    {% render 'icon-delete' %}
                                </div>
                            </div>
                        </div>
                    </div>
                {% endfor %}
            </div>

        {% when "add_product_automatically" %}
            {% if block.settings.trigger_product != blank and block.settings.product_to_add != blank %}
                {%  assign trigger_product_handle = block.settings.trigger_product %}
                {%  assign product_to_add_handle = block.settings.product_to_add %}
                {%  assign trigger_product = all_products[trigger_product_handle] %}
                {%  assign product_to_add = all_products[product_to_add_handle] %}
                {%  assign auto_delete_cart = block.settings.auto_delete %}
                {% if block.settings.hide_trash_icon_and_quantity == true %}
                    {%  assign auto_delete_cart = true %}
                {% endif %}

                <div 
                    class="add-product-automatically" 
                    to-be-added="{{product_to_add.selected_or_first_available_variant.id}}" 
                    trigger-product="{{trigger_product.id}}"
                    cart-item-property-key="{{ 'cart.cart_item_property_key' | t }}"
                    cart-item-property-value="{{ 'cart.cart_item_property_value' | t }}"
                    delete-auto="{{auto_delete_cart}}"
                ></div>
            {% endif %}
        
        {% when "upselling" %}
            {%- assign metafield_list = blank -%}

            {% if block.settings.metafield_name_one != blank %}
                {%- assign metafield_list = metafield_list |  append: block.settings.metafield_name_one |  append: ',' -%}
            {% endif %}
            {% if block.settings.metafield_name_two != blank %}
                {%- assign metafield_list = metafield_list |  append: block.settings.metafield_name_two |  append: ',' -%}
            {% endif %}
            {% if block.settings.metafield_name_three != blank %}
                {%- assign metafield_list = metafield_list |  append: block.settings.metafield_name_three |  append: ',' -%}
            {% endif %}
            {% if block.settings.metafield_name_four != blank %}
                {%- assign metafield_list = metafield_list |  append: block.settings.metafield_name_four |  append: ',' -%}
            {% endif %}
            {% if block.settings.metafield_name_five != blank %}
                {%- assign metafield_list = metafield_list |  append: block.settings.metafield_name_five |  append: ',' -%}
            {% endif %}

            {% if metafield_list != blank %}
                {%- assign metafield_list = metafield_list | split: ',' -%}
            {% endif %}

            {%- assign upsell_product_list = blank -%}
            {% comment %} Find selected {% endcomment %}
            {% for metafield in metafield_list %}
                {%- assign upsell_product = blank -%}
                {% if metafield != blank %}
                    {% assign metafield_brackets = metafield | split: "." %}
                    {% assign metafield_brackets_size = metafield_brackets | size %}
                    {% assign metafield_product_list_string = "" %}

                    {% for item in cart.items %}
                        {% assign setup_product = blank %}

                        {% if metafield_brackets_size < 2 %}
                            {% assign setup_product = item.product.metafields[metafield_brackets[0]].value %}
                        {% else if metafield_brackets_size == 2 %}
                            {% assign setup_product = item.product.metafields[metafield_brackets[0]][metafield_brackets[1]].value %}
                        {% endif %}

                        {% if setup_product != blank %}
                            {% assign metafield_product_list_string = metafield_product_list_string | append: setup_product.id | append: "," %}
                        {% endif %}
                    {% endfor %}

                    {% for item in cart.items %}
                        {%- assign metafield_product_list_string = metafield_product_list_string | replace: item.product.id, "" -%}
                    {% endfor %}

                    {% assign metafield_product_list = metafield_product_list_string | split: "," | compact %}
                    {%- assign metafield_product_id = blank -%}

                    {% for entry in metafield_product_list %}
                        {%- if entry != blank -%}
                            {%- assign metafield_product_id = entry | times: 1 -%}
                            {%- break -%}
                        {%- endif -%}
                    {% endfor %}

                    {%- if metafield_product_id != blank -%}
                        {% for theproduct in collections['all'].products %}
                            {%- if theproduct.id == metafield_product_id -%}
                                {%- assign upsell_product = theproduct -%}
                                {%- break -%}
                            {%- endif -%}
                        {% endfor %}

                        {%- if upsell_product == blank and setup_product != blank and metafield_product_id == setup_product.id -%}
                            {%- assign upsell_product = setup_product -%}
                        {% endif %} 
                    {% endif %} 
                    {%- if upsell_product != blank -%}
                        {%  assign upsell_product_list = upsell_product_list |  append: upsell_product.handle | append: ',' %}
                    {% endif %} 
                {% endif %}
            {% endfor %}

            {% comment %} Select random {% endcomment %}
            {%- if upsell_product_list == blank and block.settings.show_random and collections['all'].products.size > 1 -%}
                
                {%- assign product_list_string = "" -%}

                {% for theproduct in collections['all'].products %}
                    {%- assign product_list_string = product_list_string | append: theproduct.id | append: "," -%}
                {% endfor %}

                {% for item in cart.items %}
                    {%- assign product_list_string = product_list_string | replace: item.product.id, "" -%}
                {% endfor %} 

                {% assign product_list = product_list_string | split: "," | compact %}
                {%- assign product_list_id = blank -%}
                

                {% for entry in product_list %}
                    {%- if entry != blank -%}
                        {%- assign product_list_id = entry | times: 1 -%}
                        {%- break -%}
                    {%- endif -%}
                {% endfor %}
                
                {%- if product_list_id != blank -%}
                    {% for theproduct in collections['all'].products %}
                        {%- if theproduct.id == product_list_id -%}
                            {%  assign upsell_product_list = upsell_product_list |  append: theproduct.handle | append: ',' %}
                            {%- break -%}
                        {%- endif -%}
                    {% endfor %}
                {% endif %} 
            {% endif %} 
            
            {% comment %} Check if more then 1 product is in cart {% endcomment %}
            {%- if block.settings.show_only_by_one_product and cart.items.size > 0 -%}
                {%- assign first_product_id = cart.items[0].id -%}
                {% for item in cart.items %}
                    {%- if item.id != first_product_id -%}
                        {%- assign upsell_product_list = blank -%}
                        {%- break -%}
                    {%- endif -%}
                {% endfor %}
            {% endif %} 

            {% comment %} Show upsell {% endcomment %}
            {%- if upsell_product_list != blank -%}
                {% assign upsell_product_list = upsell_product_list | split: "," %}
                {% assign upsell_product_list = upsell_product_list | uniq %}
                {% assign upsell_product_list_size = upsell_product_list | size %}
                <script>
                    var cr_upsell_product_variantStock = {};
                    var cr_upsell_product_variants = {};
                </script>
                {%- if upsell_product_list_size > 1 -%}
                    <div class="cart-upselling">
                        <h3>{{ 'cart.upselling_header' | t }}</h3>
                        <div class="cart__upselling-slider swiper" data-list-size="{{ upsell_product_list_size }}">
                            <div class="swiper-wrapper">
                                {% for upsell_product_handle in upsell_product_list %}
                                    {%  assign upsell_product = all_products[upsell_product_handle] %}
                                    <script>
                                        cr_upsell_product_variants["{{ upsell_product.id }}"] = {{ upsell_product.variants | json }};
                                    </script>
                                    <div class="swiper-slide">
                                        <div class="cart-upselling-item-slider" style="background-color: {{ block.settings.background_color }};">
                                            {%- assign upsell_image = blank -%}
                                            {%- if upsell_product.images.size > 0 -%}
                                                {%- assign upsell_image = upsell_product.images[0] -%}
                                            {%- endif -%}
                                            {%- capture upsell_image_style -%}
                                                aspect-ratio: 1;
                                            {%- endcapture -%}

                                            <div class="cart-upselling-item-slider-image" data-product-id="{{ upsell_product.id }}">
                                                {% render 'image', image: upsell_image, style: upsell_image_style %}
                                            </div>

                                            {%- form 'product', upsell_product, id: 'cart-upselling', class: 'cart-upselling-form-class' -%}
                                            <input type="number" class="hide" name="quantity" min="1" value="1">
                                            <input type="hidden" name="id" value="{{ upsell_product.selected_or_first_available_variant.id }}">
                                            <div class="cart-upselling-form-slider">

                                                <h3><a href="{{ upsell_product.url }}">{{ upsell_product.title }}</a></h3>
                                                {% render 'price', product: upsell_product, show_compare_price: true, on_slider: true %}
                                                
                                                {%- unless upsell_product.has_only_default_variant -%}
                                                    <div class="cart-upselling-item-slider-variants" >
                                                    {%- for option in upsell_product.options_with_values -%}
                                                        <select class="cart-upselling-item-variants-select" name="{{ option.name | escape }}" main-product-id="{{ upsell_product.id}}">
                                                            {%- for value in option.values -%}
                                                                <option value="{{ value | escape }}" {% if option.selected_value == value %}selected="selected"{% endif %}>
                                                                    {{ value }}
                                                                </option>
                                                            {%- endfor -%}
                                                        </select>
                                                    {%- endfor -%}
                                                    </div>
                                                    <script>
                                                        var cr_product_upsell_{{ upsell_product.id }} = {{ upsell_product | json }};
                                                    </script>
                                                {%- endunless -%}

                                                <button class="btn" type="submit" {% if upsell_product.selected_or_first_available_variant.available == false %}disabled{% endif %} data-text-normal="{{ 'product.cart_button' | t }}" data-text-disabled="{{ 'product.cart_button_sold_out' | t }}">
                                                  {% if upsell_product.selected_or_first_available_variant.available %}
                                                    {{ 'product.cart_button' | t }}
                                                  {% else %}
                                                    {{ 'product.cart_button_sold_out' | t }}
                                                  {% endif %}
                                                </button>
                                            </div>
                                            {%- endform -%}

                                        </div>
                                    </div>
                                    <script>
                                        {% for variant in upsell_product.variants %}
                                            {% if variant.inventory_management == 'shopify' and variant.inventory_policy == 'deny' %}
                                                cr_upsell_product_variantStock[{{- variant.id -}}] = {{ variant.inventory_quantity | at_least: 0 }};
                                            {% endif %}
                                        {% endfor %}
                                    </script>
                                {% endfor %}
                            </div>
                        </div>
                    </div>
                {%- else -%}
                    {% assign upsell_product_handle = upsell_product_list[0] %}
                    {% assign upsell_product = all_products[upsell_product_handle] %}
                    <script>
                        cr_upsell_product_variants["{{ upsell_product.id }}"] = {{ upsell_product.variants | json }};
                    </script>
                    <div class="cart-upselling">
                        <h3>{{ 'cart.upselling_header' | t }}</h3>

                        <div class="cart-upselling-item" style="background-color: {{ block.settings.background_color }};">
                            {%- assign upsell_image = blank -%}
                            {%- if upsell_product.images.size > 0 -%}
                                {%- assign upsell_image = upsell_product.images[0] -%}
                            {%- endif -%}

                            <div class="cart-upselling-item-image" data-product-id="{{ upsell_product.id }}">
                                {% render 'image', image: upsell_image %}
                            </div>

                            {%- form 'product', upsell_product, id: 'cart-upselling', class: 'cart-upselling-form-class' -%}
                            <input type="number" class="hide" name="quantity" min="1" value="1">
                            <input type="hidden" name="id" value="{{ upsell_product.selected_or_first_available_variant.id }}">
                            <div class="cart-upselling-form">

                                <h3><a href="{{ upsell_product.url }}">{{ upsell_product.title }}</a></h3>
                                {% render 'price', product: upsell_product, show_compare_price: true %}
                                
                                {%- unless upsell_product.has_only_default_variant -%}
                                    <div class="cart-upselling-item-variants">
                                    {%- for option in upsell_product.options_with_values -%}
                                        <select class="cart-upselling-item-variants-select" name="{{ option.name | escape }}" main-product-id="{{ upsell_product.id}}">
                                            {%- for value in option.values -%}
                                                <option value="{{ value | escape }}" {% if option.selected_value == value %}selected="selected"{% endif %}>
                                                    {{ value }}
                                                </option>
                                            {%- endfor -%}
                                        </select>
                                    {%- endfor -%}
                                    </div>
                                    <script>
                                        var cr_product_upsell_{{ upsell_product.id }} = {{ upsell_product | json }};
                                    </script>
                                {%- endunless -%}

                                <button class="btn" type="submit" {% if upsell_product.selected_or_first_available_variant.available == false %}disabled{% endif %} data-text-normal="{{ 'product.cart_button' | t }}" data-text-disabled="{{ 'product.cart_button_sold_out' | t }}">
                                  {% if upsell_product.selected_or_first_available_variant.available %}
                                    {{ 'product.cart_button' | t }}
                                  {% else %}
                                    {{ 'product.cart_button_sold_out' | t }}
                                  {% endif %}
                                </button>
                            </div>
                            {%- endform -%}

                        </div>
                    </div>
                    <script>
                    {% for variant in upsell_product.variants %}
                        {% if variant.inventory_management == 'shopify' and variant.inventory_policy == 'deny' %}
                            cr_upsell_product_variantStock[{{- variant.id -}}] = {{ variant.inventory_quantity | at_least: 0 }};
                        {% endif %}
                    {% endfor %}
                </script>
                {%- endif -%}
            {%- endif -%}
        {% when "cart_not_reserved" %}
            <div class="cart-not-reserved-container" {% render 'overwrite-theme-style', settings: block.settings %}>
                {% render 'image', assetName: 'timer.png' %}
                <span>{{ 'cart.cart_not_reserved' | t }}</span>
            </div>
        {% when "reward-tracker" %}
            {%- assign total_handled_cents = 0 -%}

            {% comment %} get max value {% endcomment %}
            {% assign reward_free_shipping = block.settings.reward_free_shipping %}
            {% assign reward_automatically_add_product = block.settings.reward_automatically_add_product %}
            {% assign reward_discount = block.settings.reward_discount %}
            {%- assign max_value = reward_free_shipping -%}

            {%- if reward_automatically_add_product > max_value -%}
                {%- assign max_value = reward_automatically_add_product -%}
            {%- endif -%}

            {%- if reward_discount > max_value -%}
                {%- assign max_value = reward_discount -%}
            {%- endif -%}


            {%- assign free_shipping_order_value = max_value | times: 1.0 | round -%}
            {%- if max_value > 0 -%}
                {%- liquid
                    for item in cart.items
                        assign cents = item.final_line_price | append: "" | slice: -2, 2 | times: 1
                        assign cents_diff = 100 | minus: cents

                        if cents_diff == 100
                            assign cents_diff = 0
                        endif

                        if block.settings.ceil_product_prices == false
                            assign cents_diff = 0
                        endif
            
                        assign total_handled_cents = item.final_line_price | plus: cents_diff | plus: total_handled_cents
                    endfor
                %}
            {%- endif -%}
            {% assign total_handled_cents_fp = total_handled_cents | times: 1.0 %}
            {% assign free_shipping_order_value_fp = free_shipping_order_value | times: 1.0 %}
            {% assign free_shipping_percentage = total_handled_cents_fp | divided_by: free_shipping_order_value_fp | times: 100 %}
            {% assign dynamic_discount = block.settings.discount_rate | append: "%" %}

            <div class="cart-drawer-footer cart-reward-tracker" {%- if cart.item_count == 0 -%}style="display: none;"{%- endif -%} 
            >
                {%- if max_value > 0 -%}
                    <div class="ccpc ccpc-display cart-drawer-footer-free-shipping-container">
                        <h4>
                            {% assign cart_total = total_handled_cents %} 

                            {% assign discount_goal = reward_discount %}
                            {% assign free_shipping_goal = reward_free_shipping %}
                            {% assign gift_goal = reward_automatically_add_product %}

                            {% assign closest_goal = '' %}
                            {% assign remaining_amount = 99999 %} 

                            {% assign goals = "discount_goal,free_shipping_goal,gift_goal" | split: "," %}

                            {% for goal in goals %}
                                {% assign goal_value = [goal] %}
                                {% assign difference = goal_value | minus: cart_total %}
                                
                                {% if difference > 0 and difference < remaining_amount %}
                                    {% assign remaining_amount = difference %}
                                    {% assign closest_goal = forloop.index0 %}
                                {% endif %}
                            {% endfor %}
                            {% if closest_goal != '' %}
                                {%- capture missing_html -%}
                                    {%- render 'price', price: remaining_amount, single_price: true -%}
                                {%- endcapture -%}
                                {% assign dynamic_key = "cart." | append: goals[closest_goal] %}
                                {%- capture translated_goal -%}{{ dynamic_key | t |  replace: "__DISCOUNT__", dynamic_discount }}{%- endcapture -%}
                                {{ 'cart.reward_bar' | t | replace: "__PRICE__", missing_html | replace: "__REWARD__", translated_goal}}
                            {% else %}
                                <p>{{ 'cart.congratulations' | t }}</p>
                            {% endif %}
                        </h4>

                        <div class="cart-drawer-footer-free-shipping-bar" style="background-color: {{ block.settings.shipping_bar_background_color | color_to_hex }}; height: {{ block.settings.shipping_bar_height }}px;">
                            {% assign status_bar_width = 0 %}
                            {% if free_shipping_percentage > 100 %}
                                {% assign status_bar_width = 100 %}
                            {% else %}
                                {% assign status_bar_width = free_shipping_percentage %}
                            {% endif %}
                            <div class="cart-drawer-footer-free-shipping-bar-status" style="width: {{ status_bar_width }}%; background-color: {{ block.settings.shipping_bar_color | color_to_hex }};">&nbsp;</div>
                            {% if reward_free_shipping > 0 %}
                                {% assign reward_free_shipping_percentage = reward_free_shipping | divided_by: free_shipping_order_value_fp | times: 100 %}
                                <div class="cart-drawer-reward-point-container" style="left: {{ reward_free_shipping_percentage }}%;">
                                    <div class="cart-drawer-reward-point-title">
                                        {%- render 'price', price: reward_free_shipping, single_price: true -%}
                                    </div>
                                    <div class="cart-drawer-reward-point" style="{% if free_shipping_percentage > reward_free_shipping_percentage %}background-color: {{ block.settings.reward_free_shipping_point_color | color_to_hex }};{% endif %} height: {{ block.settings.reward_free_shipping_point_height }}px ; width: {{ block.settings.reward_free_shipping_point_height }}px;">
                                        {%  capture reward_free_shipping_image_style %} 
                                            width: {{ block.settings.reward_free_shipping_point_height | minus: 8 }}px;
                                            height: {{ block.settings.reward_free_shipping_point_height | minus: 8 }}px;
                                        {% endcapture %} 
                                        {% if block.settings.reward_free_shipping_icon_theme %} 
                                            {% render 'image', assetName: 'delivery-light.png', style: reward_free_shipping_image_style %}
                                        {% else %}
                                            {% render 'image', assetName: 'delivery-dark.png', style: reward_free_shipping_image_style %}
                                        {% endif %}
                                    </div>
                                    <div class="cart-drawer-reward-point-title">
                                        {{ "cart.free_shipping_goal" | t }}
                                    </div>
                                </div>
                            {% endif %}
                            {% if reward_automatically_add_product > 0 %}
                                {% assign reward_automatically_add_product_percentage = reward_automatically_add_product | divided_by: free_shipping_order_value_fp | times: 100 %}
                                {% assign reward_automatically_product_to_add_handle = block.settings.reward_automatically_add_product_id %}
                                {% if reward_automatically_product_to_add_handle != blank %}
                                    {% assign reward_automatically_product_to_add = all_products[reward_automatically_product_to_add_handle] %}
                                    {% assign reward_automatically_product_to_add_variant_id = reward_automatically_product_to_add.selected_or_first_available_variant.id %}
                                    {% assign cart_items_body = cart.items | json %}
                                    {% assign cart_items_escape = cart_items_body | escape %}
                                    <div 
                                        class="cart-auto-add-product-reward" 
                                        data-cart-amount="{{ total_handled_cents }}" 
                                        data-reward-product-id="{{ reward_automatically_product_to_add_variant_id }}" 
                                        data-reward-cost="{{reward_automatically_add_product}}"
                                        data-cart-items='{{cart_items_escape}}'
                                        data-remove-product-automatically="{{block.settings.remove_reward_product}}"
                                    ></div>
                                {% endif %}
                                <div class="cart-drawer-reward-point-container" style="left: {{ reward_automatically_add_product_percentage }}%;">
                                    <div class="cart-drawer-reward-point-title">
                                        {%- render 'price', price: reward_automatically_add_product, single_price: true -%}
                                    </div>
                                    <div class="cart-drawer-reward-point" style="{% if free_shipping_percentage > reward_automatically_add_product_percentage %}background-color: {{ block.settings.reward_automatically_add_product_point_color | color_to_hex }};{% endif %} height: {{ block.settings.reward_automatically_add_product_point_height }}px ; width: {{ block.settings.reward_automatically_add_product_point_height }}px;">
                                        {%  capture reward_automatically_add_product_image_style %} 
                                            width: {{ block.settings.reward_automatically_add_product_point_height | minus: 14 }}px;
                                            height: {{ block.settings.reward_automatically_add_product_point_height | minus: 14 }}px;
                                        {% endcapture %}
                                        {% if block.settings.reward_automatically_add_product_icon_theme %} 
                                            {% render 'image', assetName: 'gift-light.png', style: reward_automatically_add_product_image_style %}
                                        {% else %}
                                            {% render 'image', assetName: 'gift-dark.png', style: reward_automatically_add_product_image_style %}
                                        {% endif %}
                                    </div>
                                    <div class="cart-drawer-reward-point-title">
                                        {{ "cart.gift_goal" | t }}
                                    </div>
                                </div>
                            {% endif %}
                            {% if reward_discount > 0 %}
                                {% assign reward_discount_percentage = reward_discount | divided_by: free_shipping_order_value_fp | times: 100 %}
                                <div class="cart-drawer-reward-point-container" style="left: {{ reward_discount_percentage }}%;">
                                    <div class="cart-drawer-reward-point-title">
                                        {%- render 'price', price: reward_discount, single_price: true -%}
                                    </div>
                                    <div class="cart-drawer-reward-point" style="{% if free_shipping_percentage > reward_discount_percentage %}background-color: {{ block.settings.reward_discount_point_color | color_to_hex }};{% endif %} height: {{ block.settings.reward_discount_point_color_point_height }}px ; width: {{ block.settings.reward_discount_point_color_point_height }}px;">
                                        {%  capture reward_discount_image_style %} 
                                            width: {{ block.settings.reward_discount_point_color_point_height | minus: 8 }}px;
                                            height: {{ block.settings.reward_discount_point_color_point_height | minus: 8 }}px;
                                        {% endcapture %}
                                        {% if block.settings.reward_discount_icon_theme %} 
                                            {% render 'image', assetName: 'discount-light.png', style: reward_discount_image_style %}
                                        {% else %}
                                            {% render 'image', assetName: 'discount-dark.png', style: reward_discount_image_style %}
                                        {% endif %}
                                    </div>
                                    <div class="cart-drawer-reward-point-title">
                                        {{ "cart.discount_goal" | t | replace: "__DISCOUNT__", dynamic_discount}}
                                    </div>
                                </div>
                            {% endif %}
                        </div>
                    </div>
                {%- endif -%}
            </div>
        {% endcase %}
    {%- endfor -%}

    </div>

    {% comment %}========= FOOTER ========={% endcomment %}

    {%- for block in section.blocks -%}
    {% case block.type %}
        {%- when '@app' -%}
            {% render block %}
        {% when "footer" %}
            {%- assign show_deliverycosts = false -%}
            {%- if block.settings.devlivery_cost_type == "show_costs" -%}
                {%- assign show_deliverycosts = true -%}
            {%- endif -%}

            {%- assign deliverycosts = 0 -%}
            {%- if show_deliverycosts == true and block.settings.deliverycosts > 0 -%}
                {%- assign deliverycosts = block.settings.deliverycosts -%}
            {%- endif -%}

            {%- assign free_shipping_reached = false -%}
            {%- assign total_handled_cents = 0 -%}
            {%- assign free_shipping_order_value = block.settings.free_shipping_bar_ordervalue | times: 1.0 | round -%}
            {%- if block.settings.free_shipping_bar_ordervalue > 0 -%}
                {%- liquid
                    for item in cart.items
                        assign cents = item.final_line_price | append: "" | slice: -2, 2 | times: 1
                        assign cents_diff = 100 | minus: cents

                        if cents_diff == 100
                            assign cents_diff = 0
                        endif

                        if block.settings.ceil_product_prices == false
                            assign cents_diff = 0
                        endif
            
                        assign total_handled_cents = item.final_line_price | plus: cents_diff | plus: total_handled_cents
                    endfor
                %}

                {% if total_handled_cents >= free_shipping_order_value %}
                    {%- assign free_shipping_reached = true -%}
                {% endif %}
            {%- endif -%}

            <div class="cart-drawer-footer container" {%- if cart.item_count == 0 -%}style="display: none;"{%- endif -%} 
                data-delivery-costs="{{ deliverycosts }}" 
                data-free-shipping-order-value="{{ block.settings.free_shipping_bar_ordervalue }}" 
                data-ceil-product-prices="{{ block.settings.ceil_product_prices }}"
            >
                {%- if block.settings.show_free_shipping_bar and block.settings.free_shipping_bar_ordervalue > 0 -%}
                    <div class="ccpc ccpc-display cart-drawer-footer-free-shipping-container" data-cents="{{ total_handled_cents }}" data-value="{{ free_shipping_order_value }}" {% if total_handled_cents >= free_shipping_order_value %} style="display: none !important;"{% endif %}>
                        <h4>
                            {%- assign missing = free_shipping_order_value | minus: total_handled_cents -%}
                            {%- capture missing_html -%}
                                {% render 'price', price: missing %}
                            {%- endcapture -%}

                            {{ 'cart.free_shipping_bar' | t | replace: "__PRICE__", missing_html }}
                        </h4>

                        <div class="cart-drawer-footer-free-shipping-bar" style="background-color: {{ block.settings.shipping_bar_background_color | color_to_hex }}; height: {{ block.settings.shipping_bar_height }}px;">
                            {% assign total_handled_cents_fp = total_handled_cents | times: 1.0 %}
                            {% assign free_shipping_order_value_fp = free_shipping_order_value | times: 1.0 %}
                            {% assign free_shipping_percentage = total_handled_cents_fp | divided_by: free_shipping_order_value_fp | times: 100 %}
                
                            <div class="cart-drawer-footer-free-shipping-bar-status" style="width: {{ free_shipping_percentage }}%; background-color: {{ block.settings.shipping_bar_color | color_to_hex }};">&nbsp;</div>
                            <div class="cart-drawer-footer-free-shipping-bar-point" style="left: {{ free_shipping_percentage }}%; background-color: {{ block.settings.shipping_bar_point_color | color_to_hex }};">
                                {% render 'icon-shipping', color: block.settings.shipping_bar_point_icon_color %}
                            </div>
                        </div>
                    </div>
                {%- endif -%}

                {%- if block.settings.show_discount_input -%}
                    <div class="cart-drawer-footer-discount-input">
                        <input type="text" name="discount" placeholder="{{ 'cart.discount_placeholder' | t }}" />
                        <button class="btn btn-secondary">{{ 'cart.discount_submit' | t }}</button>
                    </div>
                    <div class="cart-drawer-footer-discount-input-failure">
                        {{ 'cart.discount_error' | t }}
                    </div>
                {%- endif -%}

                {%- if block.settings.show_note_input -%}
                    <div class="cart-drawer-footer-note-input">
                        <input type="text" name="note" placeholder="{{ 'cart.note_placeholder' | t }}" />
                    </div>
                {%- endif -%}

                {% if section.settings.show_discounts and cart.cart_level_discount_applications.size > 0 %}
                {% for discount_application in cart.cart_level_discount_applications %}
                    <div class="cart-drawer-footer-discount" style="color: {{ section.settings.discount_color }};">
                        {% render 'icon-discount', fill: section.settings.discount_color %}
                        <span class="cart-drawer-footer-discount-title">{{ discount_application.title }}</span>

                        {%- assign total_allocated_amount = discount_application.total_allocated_amount | times: -1 -%}
                        {% render 'price', price: total_allocated_amount %}
                    </div>
                {% endfor %}
                {% endif %}
                
                <div class="cart-drawer-footer-price headline" {%- if block.settings.show_heading == false -%}style="display: none;"{%- endif -%}>
                    <h4>{{ 'cart.total' | t }}</h4>
                </div>
                <div class="cart-drawer-footer-price" {%- if block.settings.show_subtotal == false -%}style="display: none;"{%- endif -%}>
                    <span>{{ 'cart.subtotal' | t }}</span>
                    <span class="cart-drawer-footer-subtotal">
                        {% if cart.cart_level_discount_applications.size > 0 %}
                            {% render 'price', price: cart.total_price, force_compare_price: cart.original_total_price %}
                        {% else %}
                            {% render 'price', price: cart.total_price %}
                        {% endif %}
                    </span>
                </div>
                <div class="cart-drawer-footer-price" {%- if block.settings.devlivery_cost_type == "hide" -%}style="display: none;"{%- endif -%}>
                    <span>{{ 'cart.shipping_cost_label' | t }}</span>

                    {%- assign first_class_check = false -%}
                    {%- if show_deliverycosts == true and block.settings.deliverycosts > 0 and free_shipping_reached == false -%}
                        {%- assign first_class_check = true -%}
                    {%- endif -%}

                    <span class="cart-drawer-footer-free-shipping {% if first_class_check %} cart-drawer-footer-free-shipping-costs{% endif %}" {%- if show_deliverycosts == false or free_shipping_reached or block.settings.deliverycosts == blank or block.settings.deliverycosts == 0 -%}style="color: {{ block.settings.deliverycosts_color }};"{%- endif -%} data-free-color="{{ block.settings.deliverycosts_color }}">
                        {%- assign free_shipping_label = false -%}
                        {%- if show_deliverycosts == false or free_shipping_reached or block.settings.deliverycosts == blank or block.settings.deliverycosts == 0 -%}
                            {%- assign free_shipping_label = true -%}
                        {%- endif -%}

                        <span class="free" {%- if free_shipping_label == false -%}style="display: none;"{%- endif -%}>{{ 'cart.shipping_cost_free' | t }}</span>
                        <span class="price" {%- if free_shipping_label -%}style="display: none;"{%- endif -%}>{% render 'price', price: block.settings.deliverycosts %}</span>
                    </span>
                </div>
                <div class="cart-drawer-footer-price total">
                    <span>{{ 'cart.total' | t }} {%- if block.settings.show_tax_label -%}<span class="cart-drawer-footer-tax">{{ 'cart.tax' | t }}</span>{%- endif -%}</span>
                    <span class="cart-drawer-footer-total">
                        {%- assign total = cart.total_price -%}

                        {%- if free_shipping_reached == false -%}
                            {%- assign total = cart.total_price | plus: deliverycosts -%}
                        {%- endif -%}

                        {% render 'price', price: total %}
                    </span>
                </div>

                {% if block.settings.ready_to_ship_text != blank %}
                    {%- capture ready_to_ship_style -%}
                        {%- if block.settings.ready_to_ship_center != true -%}
                            justify-content: start;
                        {%- endif -%}
                    {%- endcapture -%}

                    <div class="cart-drawer-footer-readytoship product-information-shipping-information" {% render 'overwrite-theme-style', text_color: block.settings.ready_to_ship_overwrite_theme_text_color, font_size: block.settings.ready_to_ship_overwrite_theme_font_size, append_style: ready_to_ship_style %}>
                        {%- if block.settings.ready_to_ship_show_dot -%}
                            {%- capture ready_to_ship_style -%}
                                {%- if block.settings.ready_to_ship_overwrite_theme_text_color != blank -%}
                                    {%- assign alpha = block.settings.ready_to_ship_overwrite_theme_text_color | color_extract: 'alpha' -%}
                            
                                    {%- if alpha == 1 -%}
                                        background-color: {{ block.settings.ready_to_ship_overwrite_theme_text_color | color_to_hex }}; 
                                    {%- endif -%}
                                {%- endif -%}

                                {%- if block.settings.ready_to_ship_overwrite_theme_font_size > 0 -%}
                                    min-height: calc({{ block.settings.ready_to_ship_overwrite_theme_font_size }}px * 0.75);
                                    height: calc({{ block.settings.ready_to_ship_overwrite_theme_font_size }}px * 0.75);
                                    max-height: calc({{ block.settings.ready_to_ship_overwrite_theme_font_size }}px * 0.75);

                                    min-width: calc({{ block.settings.ready_to_ship_overwrite_theme_font_size }}px * 0.75);
                                    width: calc({{ block.settings.ready_to_ship_overwrite_theme_font_size }}px * 0.75);
                                    max-width: calc({{ block.settings.ready_to_ship_overwrite_theme_font_size }}px * 0.75);
                                {%- endif -%}
                            {%- endcapture -%}

                            <span class="{% if block.settings.ready_to_ship_animate_dot %}animate{% endif %}" style="{{ ready_to_ship_style | strip_newlines }}"></span>
                        {%- endif -%}
                        
                        <div>{{ block.settings.ready_to_ship_text }}</div>
                    </div>
                {% endif %} 

                {% if block.settings.additional_checkout_buttons %}
                    <div class="additional-checkout-buttons">
                        {{ content_for_additional_checkout_buttons }}
                    </div>
                {% endif %} 

                {% if block.settings.button_shadow %}
                    {%- assign box_shadow_color = settings.color_primary -%}

                    {%- if block.settings.button_shadow_color != blank -%}
                        {%- assign alpha = block.settings.button_shadow_color | color_extract: 'alpha' -%}
                
                        {%- if alpha == 1 -%}
                            {%- assign box_shadow_color = block.settings.button_shadow_color -%}
                        {%- endif -%}
                    {%- endif -%}
                
                    {%- capture style -%}
                        box-shadow: 0 8px 24px {% render 'color-to-rgba', color: box_shadow_color, percentage: block.settings.button_shadow_alpha_percentage %};
                    {%- endcapture -%}
                {% endif %}
        
                <a href="/checkout" class="btn show-loading-indicator {% if block.settings.animated_checkout_button %} cart-drawer-footer-button-animated {% endif %}"  {% render 'overwrite-theme-style', settings: block.settings, append_style: style %}>
                    {%- if block.settings.show_cart_icon -%}
                        {% render 'icon-cart' %}
                    {%- endif -%}

                    <span>{{ 'cart.checkout_button' | t }}</span>
                </a>
        
                <div class="ccpc ccpc-display cart-drawer-footer-payment-providers {% if block.settings.show_payment_provider == false %} hide {% endif %}">{% render 'payment-provider' %}</div>
            </div>
    {% endcase %}
    {%- endfor -%}

    <div class="cart-drawer-empty" {%- if cart.item_count > 0 -%}style="display: none;"{%- endif -%}>
        <h3>{{ 'cart.empty' | t }}</h3>
        <a href="{{ section.settings.empty_cart_link }}" class="btn">{{ 'cart.empty_button' | t }}</a>
    </div>

</div>

{% comment %} ===== Section Help Video ===== {% endcomment %}
{%- if request.design_mode -%}
    <div 
        class="section-help-video-identifier" 
        data-title="{{ 'conrise.sectionHelpTitles.cart-drawer' | t }}", 
        data-video="3cbb0daf0db74cb1bfb775c84a4f0720?sid=15497620-0a79-4140-9aeb-afd25f2644a5"
        data-padding-bottom="55.95854922279793%"
    ></div>
{%- endif -%}
{% comment %} ===== Section Help Video ===== {% endcomment %}

{% schema %}
{
    "name": "t:sections.cart-drawer.name",
    "settings": [
        {
            "type": "header",
            "content": "t:settings.general.section_help_video",
            "info": "[Video](https://www.loom.com/share/3cbb0daf0db74cb1bfb775c84a4f0720?sid=15497620-0a79-4140-9aeb-afd25f2644a5)"
        },
        {
            "type": "color",
            "id": "icon_color",
            "label": "t:sections.cart-drawer.settings.icon_color",
            "default": "#000000"
        },
        {
            "type": "url",
            "id": "empty_cart_link",
            "label": "t:sections.cart-drawer.settings.empty_cart_link",
            "default": "/"
        },
        {
            "type": "checkbox",
            "id": "show_discounts",
            "default": true,
            "label": "t:sections.cart-drawer.settings.show_discounts"
        },
        {
            "type": "color",
            "id": "discount_color",
            "label": "t:sections.cart-drawer.settings.discount_color",
            "default": "#ab0b0b"
        },
        {
            "type": "range",
            "id": "overwrite_drawer_mobile_width",
            "label": "t:sections.cart-drawer.settings.overwrite_drawer_mobile_width",
            "min": 50,
            "max": 100,
            "step": 1,
            "unit": "%",
            "default": 100
        },
        {
            "type": "header",
            "content": "t:sections.cart-drawer.settings.bundle_header",
            "info": "t:sections.cart-drawer.settings.bundle_header_info"
        },
        {
            "type": "text",
            "id": "bundle_discount_name",
            "label": "t:sections.cart-drawer.settings.bundle_discount_name"
        },
        {
            "type": "select",
            "id": "bundle_discount_type",
            "default": "percentage",
            "label": "t:sections.section-bundle.settings.discount_type",
            "options": [
                {
                    "value": "percentage",
                    "label": "t:sections.section-bundle.settings.discount_type_percentage"
                },
                {
                    "value": "value",
                    "label": "t:sections.section-bundle.settings.discount_type_value"
                }
            ]
        },
        {
            "type": "number",
            "id": "bundle_discount_value",
            "label": "t:sections.section-bundle.settings.discount_value",
            "info": "t:sections.section-bundle.settings.discount_value_info"
        },
        {
            "type": "header",
            "content": "t:sections.cart-drawer.settings.set_header",
            "info": "t:sections.cart-drawer.settings.set_header_info"
        },
        {
            "type": "text",
            "id": "set_discount_name",
            "label": "t:sections.cart-drawer.settings.set_discount_name"
        },
        {
            "type": "range",
            "id": "set_product_count",
            "label": "t:sections.cart-drawer.settings.set_product_count",
            "min": 0,
            "max": 20,
            "step": 1,
            "unit": "#",
            "default": 0
        },
        {
            "type": "range",
            "id": "set_free_product_count",
            "label": "t:sections.cart-drawer.settings.set_free_product_count",
            "min": 0,
            "max": 20,
            "step": 1,
            "unit": "#",
            "default": 0
        },
        {
            "type": "text",
            "id": "set_discount_product_price",
            "label": "t:sections.cart-drawer.settings.set_discount_product_price",
            "info": "t:sections.cart-drawer.settings.set_discount_product_price_info"
        },
        {
            "type": "header",
            "content": "t:sections.cart-drawer.settings.set_header_2",
            "info": "t:sections.cart-drawer.settings.set_header_info"
        },
        {
            "type": "text",
            "id": "set_discount_name_2",
            "label": "t:sections.cart-drawer.settings.set_discount_name"
        },
        {
            "type": "range",
            "id": "set_product_count_2",
            "label": "t:sections.cart-drawer.settings.set_product_count",
            "min": 0,
            "max": 20,
            "step": 1,
            "unit": "#",
            "default": 0
        },
        {
            "type": "range",
            "id": "set_free_product_count_2",
            "label": "t:sections.cart-drawer.settings.set_free_product_count",
            "min": 0,
            "max": 20,
            "step": 1,
            "unit": "#",
            "default": 0
        },
        {
            "type": "text",
            "id": "set_discount_product_price_2",
            "label": "t:sections.cart-drawer.settings.set_discount_product_price",
            "info": "t:sections.cart-drawer.settings.set_discount_product_price_info"
        },
        {
            "type": "header",
            "content": "t:sections.general.theme-settings.content",
            "info": "t:sections.general.theme-settings.info"
        },
        {
            "type": "color",
            "id": "overwrite_theme_text_color",
            "label": "t:sections.cart-drawer.settings.overwrite_theme_text_color",
            "info": "t:sections.cart-drawer.settings.overwrite_theme_text_color_info"
        },
        {
            "type": "color",
            "id": "overwrite_theme_background_color",
            "label": "t:sections.cart-drawer.settings.overwrite_theme_background_color",
            "info": "t:sections.cart-drawer.settings.overwrite_theme_background_color_info"
        }
    ],
    "blocks": [
        {
            "type": "@app"
        },
        {
            "type": "reward-tracker",
            "name": "t:sections.cart-drawer.blocks.reward_tracker.name",
            "limit": 1,
            "settings": [
                {
                    "type": "header",
                    "content": "t:sections.cart-drawer.blocks.reward_tracker.settings.free_shipping_header"
                },
                {
                    "type": "number",
                    "id": "reward_free_shipping",
                    "label": "t:sections.cart-drawer.blocks.reward_tracker.settings.reward_free_shipping",
                    "default": 5000
                },
                {
                    "type": "color",
                    "id": "reward_free_shipping_point_color",
                    "label": "t:sections.cart-drawer.blocks.reward_tracker.settings.point_color",
                    "default": "#aeebb6"
                },
                {
                    "type": "checkbox",
                    "id": "reward_free_shipping_icon_theme",
                    "default": false,
                    "label": "t:sections.cart-drawer.blocks.reward_tracker.settings.icon_theme"
                },
                {
                    "type": "range",
                    "id": "reward_free_shipping_point_height",
                    "label": "t:sections.cart-drawer.blocks.reward_tracker.settings.point_height",
                    "min": 0,
                    "max": 50,
                    "step": 1,
                    "unit": "px",
                    "default": 32
                },
                {
                    "type": "header",
                    "content": "t:sections.cart-drawer.blocks.reward_tracker.settings.gift_product_header"
                },
                {
                    "type": "number",
                    "id": "reward_automatically_add_product",
                    "label": "t:sections.cart-drawer.blocks.reward_tracker.settings.gift_product_cost",
                    "default": 10000
                },
                {
                    "type": "product",
                    "id": "reward_automatically_add_product_id",
                    "label": "t:sections.cart-drawer.blocks.reward_tracker.settings.product_to_add"
                },
                {
                    "type": "checkbox",
                    "id": "remove_reward_product",
                    "default": false,
                    "label": "t:sections.cart-drawer.blocks.reward_tracker.settings.remove_product_auto",
                    "info": "t:sections.cart-drawer.blocks.reward_tracker.settings.remove_product_auto_info"
                },
                {
                    "type": "color",
                    "id": "reward_automatically_add_product_point_color",
                    "label": "t:sections.cart-drawer.blocks.reward_tracker.settings.point_color",
                    "default": "#aeebb6"
                },
                {
                    "type": "checkbox",
                    "id": "reward_automatically_add_product_icon_theme",
                    "default": false,
                    "label": "t:sections.cart-drawer.blocks.reward_tracker.settings.icon_theme"
                },
                {
                    "type": "range",
                    "id": "reward_automatically_add_product_point_height",
                    "label": "t:sections.cart-drawer.blocks.reward_tracker.settings.point_height",
                    "min": 0,
                    "max": 50,
                    "step": 1,
                    "unit": "px",
                    "default": 32
                },
                {
                    "type": "header",
                    "content": "t:sections.cart-drawer.blocks.reward_tracker.settings.discount_header"
                },
                {
                    "type": "number",
                    "id": "reward_discount",
                    "label": "t:sections.cart-drawer.blocks.reward_tracker.settings.gift_product_cost",
                    "default": 15000,
                    "info": "t:sections.cart-drawer.blocks.reward_tracker.settings.discount_info"
                },
                {
                    "type": "number",
                    "id": "discount_rate",
                    "label": "t:sections.cart-drawer.blocks.reward_tracker.settings.discount_rate",
                    "info": "t:sections.cart-drawer.blocks.reward_tracker.settings.discount_rate_info",
                    "default": 10
                },
                {
                    "type": "color",
                    "id": "reward_discount_point_color",
                    "label": "t:sections.cart-drawer.blocks.reward_tracker.settings.point_color",
                    "default": "#aeebb6"
                },
                {
                    "type": "checkbox",
                    "id": "reward_discount_icon_theme",
                    "default": false,
                    "label": "t:sections.cart-drawer.blocks.reward_tracker.settings.icon_theme"
                },
                {
                    "type": "range",
                    "id": "reward_discount_point_color_point_height",
                    "label": "t:sections.cart-drawer.blocks.reward_tracker.settings.point_height",
                    "min": 0,
                    "max": 50,
                    "step": 1,
                    "unit": "px",
                    "default": 32
                },
                {
                    "type": "header",
                    "content": "t:sections.cart-drawer.blocks.reward_tracker.settings.settings_header"
                },
                {
                    "type": "color",
                    "id": "shipping_bar_background_color",
                    "label": "t:sections.cart-drawer.blocks.reward_tracker.settings.bar_background_color",
                    "default": "#d9d9d9"
                },
                {
                    "type": "color",
                    "id": "shipping_bar_color",
                    "label": "t:sections.cart-drawer.blocks.reward_tracker.settings.bar_color",
                    "default": "#008B10"
                },
                {
                    "type": "range",
                    "id": "shipping_bar_height",
                    "label": "t:sections.cart-drawer.blocks.reward_tracker.settings.bar_height",
                    "min": 0,
                    "max": 50,
                    "step": 1,
                    "unit": "px",
                    "default": 16
                }
            ]
        },
        {
            "type": "shipping_info",
            "name": "t:sections.cart-drawer.blocks.shipping_info.name",
            "limit": 1,
            "settings": [
                {
                    "type": "number",
                    "id": "days_until_arrive",
                    "label": "t:sections.cart-drawer.blocks.shipping_info.settings.days_until_arrive",
                    "default": 3,
                    "info": "t:sections.cart-drawer.blocks.shipping_info.settings.days_until_arrive_info"
                },
                {
                    "type": "checkbox",
                    "id": "exclude_sundays",
                    "default": true,
                    "label": "t:sections.cart-drawer.blocks.shipping_info.settings.exclude_sundays"
                },
                {
                    "type": "select",
                    "id": "display_format",
                    "default": "day",
                    "label": "t:sections.cart-drawer.blocks.shipping_info.settings.display_format",
                    "options": [
                        {
                            "value": "day",
                            "label": "t:sections.cart-drawer.blocks.shipping_info.settings.day"
                        },
                        {
                            "value": "day_month",
                            "label": "t:sections.cart-drawer.blocks.shipping_info.settings.day_month"
                        },
                        {
                            "value": "day_month_year",
                            "label": "t:sections.cart-drawer.blocks.shipping_info.settings.day_month_year"
                        }
                    ]
                },
                {
                    "type": "header",
                    "content": "t:sections.general.color"
                },
                {
                    "type": "color",
                    "id": "overwrite_theme_text_color",
                    "label": "t:sections.cart-drawer.blocks.shipping_info.settings.overwrite_theme_text_color",
                    "default": "#007600"
                },
                {
                    "type": "color",
                    "id": "overwrite_theme_background_color",
                    "label": "t:sections.cart-drawer.blocks.shipping_info.settings.overwrite_theme_background_color",
                    "default": "#EBFCE9"
                },
                {
                    "type": "header",
                    "content": "t:sections.general.margin"
                },
                {
                    "type": "range",
                    "id": "overwrite_theme_margin_top",
                    "label": "t:sections.cart-drawer.blocks.shipping_info.settings.overwrite_theme_margin_top",
                    "min": -50,
                    "max": 50,
                    "step": 1,
                    "unit": "px",
                    "default": 0
                },
                {
                    "type": "range",
                    "id": "overwrite_theme_margin_bottom",
                    "label": "t:sections.cart-drawer.blocks.shipping_info.settings.overwrite_theme_margin_bottom",
                    "min": -50,
                    "max": 50,
                    "step": 1,
                    "unit": "px",
                    "default": 16
                },
                {
                    "type": "header",
                    "content": "t:sections.general.theme-settings.content",
                    "info": "t:sections.general.theme-settings.info"
                },
                {
                    "type": "range",
                    "id": "overwrite_theme_font_size",
                    "label": "t:sections.cart-drawer.blocks.shipping_info.settings.overwrite_theme_font_size",
                    "min": 0,
                    "max": 50,
                    "step": 1,
                    "unit": "px",
                    "default": 0,
                    "info": "t:sections.cart-drawer.blocks.shipping_info.settings.overwrite_theme_font_size_info"
                }
            ]
        },
        {
            "type": "cart_items",
            "name": "t:sections.cart-drawer.blocks.cart_items.name",
            "limit": 1,
            "settings": [
                {
                    "type": "header",
                    "content": "t:sections.general.settings"
                },
                {
                    "type": "select",
                    "id": "variant_display_type",
                    "default": "options",
                    "label": "t:sections.cart-drawer.blocks.cart_items.settings.variant_display_type",
                    "options": [
                        {
                            "value": "none",
                            "label": "t:sections.cart-drawer.blocks.cart_items.settings.variant_display_type_none"
                        },
                        {
                            "value": "title",
                            "label": "t:sections.cart-drawer.blocks.cart_items.settings.variant_display_type_title"
                        },
                        {
                            "value": "options",
                            "label": "t:sections.cart-drawer.blocks.cart_items.settings.variant_display_type_options"
                        }
                    ]
                },
                {
                    "type": "checkbox",
                    "id": "show_info_text",
                    "default": false,
                    "label": "t:sections.cart-drawer.blocks.cart_items.settings.show_info_text",
                    "info": "t:sections.cart-drawer.blocks.cart_items.settings.show_info_text_info"
                },
                {
                    "type": "text",
                    "id": "info_text_metafield_name",
                    "label": "t:sections.cart-drawer.blocks.cart_items.settings.info_text_metafield_name",
                    "info": "t:sections.cart-drawer.blocks.cart_items.settings.info_text_metafield_name_info"
                },
                {
                    "type": "checkbox",
                    "id": "clickable_title",
                    "default": false,
                    "label": "t:sections.cart-drawer.blocks.cart_items.settings.clickable_title"
                },
                {
                    "type": "checkbox",
                    "id": "show_quantity_field",
                    "default": true,
                    "label": "t:sections.cart-drawer.blocks.cart_items.settings.show_quantity_field"
                },
                {
                    "type": "checkbox",
                    "id": "show_remove_button",
                    "default": true,
                    "label": "t:sections.cart-drawer.blocks.cart_items.settings.show_remove_button"
                },
                {
                    "type": "header",
                    "content": "t:sections.cart-drawer.blocks.cart_items.settings.product_image_size"
                },
                {
                    "type": "range",
                    "id": "image_width_mobile",
                    "label": "t:sections.cart-drawer.blocks.cart_items.settings.image_width_mobile",
                    "min": 0,
                    "max": 100,
                    "step": 1,
                    "unit": "%",
                    "default": 32
                },
                {
                    "type": "range",
                    "id": "image_width_desktop",
                    "label": "t:sections.cart-drawer.blocks.cart_items.settings.image_width_desktop",
                    "min": 0,
                    "max": 100,
                    "step": 1,
                    "unit": "%",
                    "default": 35
                },
                {
                    "type": "header",
                    "content": "t:sections.general.margin"
                },
                {
                    "type": "range",
                    "id": "overwrite_theme_margin_top",
                    "label": "t:sections.cart-drawer.blocks.cart_items.settings.overwrite_theme_margin_top",
                    "min": -50,
                    "max": 50,
                    "step": 1,
                    "unit": "px",
                    "default": 0
                },
                {
                    "type": "range",
                    "id": "overwrite_theme_margin_bottom",
                    "label": "t:sections.cart-drawer.blocks.cart_items.settings.overwrite_theme_margin_bottom",
                    "min": -50,
                    "max": 50,
                    "step": 1,
                    "unit": "px",
                    "default": 0
                },
                {
                    "type": "header",
                    "content": "t:sections.general.theme-settings.content",
                    "info": "t:sections.general.theme-settings.info"
                },
                {
                    "type": "color",
                    "id": "overwrite_theme_text_color",
                    "label": "t:sections.cart-drawer.blocks.cart_items.settings.overwrite_theme_text_color",
                    "info": "t:sections.cart-drawer.blocks.cart_items.settings.overwrite_theme_text_color_info"
                },
                {
                    "type": "color",
                    "id": "price_color",
                    "label": "t:sections.cart-drawer.blocks.cart_items.settings.price_color",
                    "info": "t:sections.cart-drawer.blocks.cart_items.settings.price_color_info"
                },
                {
                    "type": "range",
                    "id": "heading_font_size",
                    "label": "t:sections.cart-drawer.blocks.cart_items.settings.heading_font_size",
                    "min": 0,
                    "max": 50,
                    "step": 1,
                    "unit": "px",
                    "default": 0,
                    "info": "t:sections.cart-drawer.blocks.cart_items.settings.heading_font_size_info"
                },
                {
                    "type": "range",
                    "id": "text_font_size",
                    "label": "t:sections.cart-drawer.blocks.cart_items.settings.text_font_size",
                    "min": 0,
                    "max": 50,
                    "step": 1,
                    "unit": "px",
                    "default": 0,
                    "info": "t:sections.cart-drawer.blocks.cart_items.settings.text_font_size_info"
                }
            ]
        },
        {
            "type": "cart_not_reserved",
            "name": "t:sections.cart-drawer.blocks.cart_not_reserved.name",
            "limit": 1,
            "settings": [
                {
                    "type": "header",
                    "content": "t:sections.general.color"
                },
                {
                    "type": "color",
                    "id": "overwrite_theme_text_color",
                    "label": "t:sections.cart-drawer.blocks.cart_not_reserved.settings.overwrite_theme_text_color",
                    "default": "#000000"
                },
                {
                    "type": "header",
                    "content": "t:sections.general.margin"
                },
                {
                    "type": "range",
                    "id": "overwrite_theme_margin_top",
                    "label": "t:sections.cart-drawer.blocks.cart_not_reserved.settings.overwrite_theme_margin_top",
                    "min": -50,
                    "max": 50,
                    "step": 1,
                    "unit": "px",
                    "default": 0
                },
                {
                    "type": "range",
                    "id": "overwrite_theme_margin_bottom",
                    "label": "t:sections.cart-drawer.blocks.cart_not_reserved.settings.overwrite_theme_margin_bottom",
                    "min": -50,
                    "max": 50,
                    "step": 1,
                    "unit": "px",
                    "default": 0
                },
                {
                    "type": "header",
                    "content": "t:sections.general.theme-settings.content",
                    "info": "t:sections.general.theme-settings.info"
                },
                {
                    "type": "range",
                    "id": "overwrite_theme_font_size",
                    "label": "t:sections.cart-drawer.blocks.cart_not_reserved.settings.overwrite_theme_font_size",
                    "min": 0,
                    "max": 50,
                    "step": 1,
                    "unit": "px",
                    "default": 0,
                    "info": "t:sections.cart-drawer.blocks.cart_not_reserved.settings.overwrite_theme_font_size_info"
                }
            ]
        },
        {
            "type": "upselling",
            "name": "t:sections.cart-drawer.blocks.upselling.name",
            "limit": 1,
            "settings": [
                {
                    "type": "checkbox",
                    "id": "show_random",
                    "default": true,
                    "label": "t:sections.cart-drawer.blocks.upselling.settings.show_random"
                },
                {
                    "type": "checkbox",
                    "id": "show_only_by_one_product",
                    "default": true,
                    "label": "t:sections.cart-drawer.blocks.upselling.settings.show_only_by_one_product"
                },
                {
                    "type": "color",
                    "id": "background_color",
                    "label": "t:sections.cart-drawer.blocks.upselling.settings.background_color",
                    "default": "#ececec"
                },
                {
                    "type": "header",
                    "content": "t:sections.cart-drawer.blocks.upselling.settings.headline",
                    "info": "t:sections.cart-drawer.blocks.upselling.settings.headline_info"
                },
                {
                    "type": "text",
                    "id": "metafield_name_one",
                    "label": "t:sections.cart-drawer.blocks.upselling.settings.metafield_name_1"
                },
                {
                    "type": "text",
                    "id": "metafield_name_two",
                    "label": "t:sections.cart-drawer.blocks.upselling.settings.metafield_name_2"
                },
                {
                    "type": "text",
                    "id": "metafield_name_three",
                    "label": "t:sections.cart-drawer.blocks.upselling.settings.metafield_name_3"
                },
                {
                    "type": "text",
                    "id": "metafield_name_four",
                    "label": "t:sections.cart-drawer.blocks.upselling.settings.metafield_name_4"
                },
                {
                    "type": "text",
                    "id": "metafield_name_five",
                    "label": "t:sections.cart-drawer.blocks.upselling.settings.metafield_name_5"
                }
            ]
        },
        {
            "type": "add_product_automatically",
            "name": "t:sections.cart-drawer.blocks.add_product_automatically.name",
            "limit": 1,
            "settings": [
                {
                    "type": "product",
                    "id": "trigger_product",
                    "label": "t:sections.cart-drawer.blocks.add_product_automatically.settings.trigger_product",
                    "info": "t:sections.cart-drawer.blocks.add_product_automatically.settings.trigger_product_info"
                },
                {
                    "type": "product",
                    "id": "product_to_add",
                    "label": "t:sections.cart-drawer.blocks.add_product_automatically.settings.product_to_add",
                    "info": "t:sections.cart-drawer.blocks.add_product_automatically.settings.product_to_add_info"
                },
                {
                    "type": "checkbox",
                    "id": "free_price",
                    "default": false,
                    "label": "t:sections.cart-drawer.blocks.add_product_automatically.settings.free_price",
                    "info": "t:sections.cart-drawer.blocks.add_product_automatically.settings.free_price_info"
                },
                {
                    "type": "checkbox",
                    "id": "hide_trash_icon_and_quantity",
                    "default": false,
                    "label": "t:sections.cart-drawer.blocks.add_product_automatically.settings.hide_trash_icon_and_quantity",
                    "info": "t:sections.cart-drawer.blocks.add_product_automatically.settings.hide_trash_icon_and_quantity_info"
                },
                {
                    "type": "checkbox",
                    "id": "auto_delete",
                    "default": false,
                    "label": "t:sections.cart-drawer.blocks.add_product_automatically.settings.auto_delete",
                    "info": "t:sections.cart-drawer.blocks.add_product_automatically.settings.auto_delete_info"
                }
            ]
        },
        {
            "type": "footer",
            "name": "t:sections.cart-drawer.blocks.footer.name",
            "limit": 1,
            "settings": [
                {
                    "type": "header",
                    "content": "t:sections.general.settings"
                },
                {
                    "type": "checkbox",
                    "id": "show_heading",
                    "default": false,
                    "label": "t:sections.cart-drawer.blocks.footer.settings.show_heading"
                },
                {
                    "type": "checkbox",
                    "id": "show_subtotal",
                    "default": true,
                    "label": "t:sections.cart-drawer.blocks.footer.settings.show_subtotal"
                },
                {
                    "type": "checkbox",
                    "id": "show_tax_label",
                    "default": true,
                    "label": "t:sections.cart-drawer.blocks.footer.settings.show_tax_label"
                },
                {
                    "type": "checkbox",
                    "id": "animated_checkout_button",
                    "default": false,
                    "label": "t:sections.cart-drawer.blocks.footer.settings.animated_checkout_button"
                },
                {
                    "type": "checkbox",
                    "id": "additional_checkout_buttons",
                    "default": false,
                    "label": "t:sections.cart-drawer.blocks.footer.settings.additional_checkout_buttons"
                },
                {
                    "type": "checkbox",
                    "id": "show_payment_provider",
                    "default": true,
                    "label": "t:sections.cart-drawer.blocks.footer.settings.show_payment_provider"
                },
                {
                    "type": "checkbox",
                    "id": "show_discount_input",
                    "default": true,
                    "label": "t:sections.cart-drawer.blocks.footer.settings.show_discount_input"
                },
                {
                    "type": "checkbox",
                    "id": "show_note_input",
                    "default": false,
                    "label": "t:sections.cart-drawer.blocks.footer.settings.show_note_input"
                },
                {
                    "type": "checkbox",
                    "id": "show_cart_icon",
                    "default": true,
                    "label": "t:sections.cart-drawer.blocks.footer.settings.show_cart_icon"
                },
                {
                    "type": "header",
                    "content": "t:sections.cart-drawer.blocks.footer.settings.delivery_costs"
                },
                {
                    "type": "select",
                    "id": "devlivery_cost_type",
                    "label": "t:sections.cart-drawer.blocks.footer.settings.devlivery_cost_type",
                    "default": "free",
                    "options": [
                        {
                            "value": "free",
                            "label": "t:sections.cart-drawer.blocks.footer.settings.devlivery_cost_type_free"
                        },
                        {
                            "value": "show_costs",
                            "label": "t:sections.cart-drawer.blocks.footer.settings.devlivery_cost_type_show_costs"
                        },
                        {
                            "value": "hide",
                            "label": "t:sections.cart-drawer.blocks.footer.settings.devlivery_cost_type_hide"
                        }
                    ]
                },
                {
                    "type": "color",
                    "id": "deliverycosts_color",
                    "label": "t:sections.cart-drawer.blocks.footer.settings.deliverycosts_color",
                    "default": "#008b10"
                },
                {
                    "type": "number",
                    "id": "deliverycosts",
                    "label": "t:sections.cart-drawer.blocks.footer.settings.deliverycosts",
                    "info": "t:sections.cart-drawer.blocks.footer.settings.deliverycosts_info",
                    "default": 390
                },
                {
                    "type": "number",
                    "id": "free_shipping_bar_ordervalue",
                    "label": "t:sections.cart-drawer.blocks.footer.settings.free_shipping_bar_ordervalue",
                    "info": "t:sections.cart-drawer.blocks.footer.settings.free_shipping_bar_ordervalue_info",
                    "default": 10000
                },
                {
                    "type": "checkbox",
                    "id": "ceil_product_prices",
                    "default": true,
                    "label": "t:sections.cart-drawer.blocks.footer.settings.ceil_product_prices",
                    "info": "t:sections.cart-drawer.blocks.footer.settings.ceil_product_prices_info"
                },
                {
                    "type": "checkbox",
                    "id": "show_free_shipping_bar",
                    "default": false,
                    "label": "t:sections.cart-drawer.blocks.footer.settings.show_free_shipping_bar"
                },
                {
                    "type": "color",
                    "id": "shipping_bar_background_color",
                    "label": "t:sections.cart-drawer.blocks.footer.settings.shipping_bar_background_color",
                    "default": "#d9d9d9"
                },
                {
                    "type": "color",
                    "id": "shipping_bar_color",
                    "label": "t:sections.cart-drawer.blocks.footer.settings.shipping_bar_color",
                    "default": "#008B10"
                },
                {
                    "type": "color",
                    "id": "shipping_bar_point_color",
                    "label": "t:sections.cart-drawer.blocks.footer.settings.shipping_bar_point_color",
                    "default": "#002905"
                },
                {
                    "type": "color",
                    "id": "shipping_bar_point_icon_color",
                    "label": "t:sections.cart-drawer.blocks.footer.settings.shipping_bar_point_icon_color",
                    "default": "#ffffff"
                },
                {
                    "type": "range",
                    "id": "shipping_bar_height",
                    "label": "t:sections.cart-drawer.blocks.footer.settings.shipping_bar_height",
                    "min": 0,
                    "max": 50,
                    "step": 1,
                    "unit": "px",
                    "default": 16
                },
                {
                    "type": "header",
                    "content": "t:sections.cart-drawer.blocks.footer.settings.ready_to_ship",
                    "info": "t:sections.cart-drawer.blocks.footer.settings.ready_to_ship_info"
                },
                {
                    "type": "richtext",
                    "id": "ready_to_ship_text",
                    "label": "t:sections.cart-drawer.blocks.footer.settings.ready_to_ship_text",
                    "default": "<p>Auf Lager - Bereit für den Versand.</p>"
                },
                {
                    "type": "checkbox",
                    "id": "ready_to_ship_show_dot",
                    "default": true,
                    "label": "t:sections.cart-drawer.blocks.footer.settings.ready_to_ship_show_dot"
                },
                {
                    "type": "checkbox",
                    "id": "ready_to_ship_animate_dot",
                    "default": true,
                    "label": "t:sections.cart-drawer.blocks.footer.settings.ready_to_ship_animate_dot"
                },
                {
                    "type": "checkbox",
                    "id": "ready_to_ship_center",
                    "default": true,
                    "label": "t:sections.cart-drawer.blocks.footer.settings.ready_to_ship_center"
                },
                {
                    "type": "range",
                    "id": "ready_to_ship_overwrite_theme_font_size",
                    "label": "t:sections.cart-drawer.blocks.footer.settings.ready_to_ship_overwrite_theme_font_size",
                    "min": 0,
                    "max": 40,
                    "step": 1,
                    "unit": "px",
                    "default": 14
                },
                {
                    "type": "color",
                    "id": "ready_to_ship_overwrite_theme_text_color",
                    "label": "t:sections.cart-drawer.blocks.footer.settings.ready_to_ship_overwrite_theme_text_color",
                    "default": "#409B07"
                },
                {
                    "type": "header",
                    "content": "t:sections.cart-drawer.blocks.footer.settings.button_drop_shadow"
                },
                {
                    "type": "checkbox",
                    "id": "button_shadow",
                    "default": false,
                    "label": "t:sections.cart-drawer.blocks.footer.settings.button_shadow"
                },
                {
                    "type": "color",
                    "id": "button_shadow_color",
                    "label": "t:sections.cart-drawer.blocks.footer.settings.button_shadow_color",
                    "info": "t:sections.cart-drawer.blocks.footer.settings.button_shadow_color_info"
                },
                {
                    "type": "range",
                    "id": "button_shadow_alpha_percentage",
                    "label": "t:sections.cart-drawer.blocks.footer.settings.button_shadow_alpha_percentage",
                    "min": 0,
                    "max": 100,
                    "step": 1,
                    "unit": "%",
                    "default": 50
                },
                {
                    "type": "header",
                    "content": "t:sections.general.theme-settings.content",
                    "info": "t:sections.general.theme-settings.info"
                },
                {
                    "type": "range",
                    "id": "overwrite_theme_vertical_padding",
                    "label": "t:sections.cart-drawer.blocks.footer.settings.overwrite_theme_vertical_padding",
                    "info": "t:sections.cart-drawer.blocks.footer.settings.overwrite_theme_vertical_padding_info",
                    "min": 0,
                    "max": 50,
                    "step": 1,
                    "unit": "px",
                    "default": 15
                }
            ]
        }
    ],
    "default": {
        "blocks": [
            {
                "type": "shipping_info"
            },
            {
                "type": "reward-tracker"
            },
            {
                "type": "cart_items"
            },
            {
                "type": "upselling"
            },
            {
                "type": "footer"
            }
        ]
    }
}
{% endschema %}