Products with line item properties won't remove from cart properly

Hello Community!

I am looking for a solution to a problem I am having with products that have line item properties and getting them to remove from the cart properly. I followed this tutorial (Get customization information for products) and the part where it says to make sure to update the links that remove items from the cart as you can see in part of my cart-template.liquid code (see 1. below). The good news is that it works if just one of the products is in the cart. The bad news is whenever I try to remove one of the products with a line item property and there is more than one in the cart a message pops up that looks like this (see 2. below) and the page has to be reloaded to continue editing the cart which can be quite the hassle if there are multiple items in the cart with line item properties. The theme my store uses is debut. I have multiple products with line item properties but I’m hoping that once one of them gets the issue resolved I can fix the others as well. I have included part of the code of one of the product templates below (see 3. below). I don’t know if I am placing anything where it shouldn’t go but any help would be VERY much appreciated.

  1. (code I changed is in a burgundy color)

{%- comment -%}
Optional, loop through custom product line items if available

Line item properties come in as having two parts. The first part will be passed with the default form,
but p.last is the actual custom property and may be blank. If it is, don’t show it.

For more info on line item properties, visit:

{%- assign properties = 'template ’ | split: ’ ’ -%}
{%- if property_size > 0 -%}
{%- assign properties = item.properties -%}
{%- endif -%}

{%- for p in properties -%}
{%- unless p.last == blank -%}

  • {{ p.first }}:

    {%- comment -%}
    Check if there was an uploaded file associated
    {%- endcomment -%}

    {%- if p.last contains ‘/uploads/’ -%}
    {{ p.last | split: ‘/’ | last }}
    {%- else -%}
    {{ p.last }}
    {%- endif -%}

  • {%- endunless -%} {%- endfor -%}

    {{ 'cart.general.remove' | t }}

    {%- assign hasDiscount = false -%}
    {%- if item.original_price != item.final_price -%}
    {%- assign hasDiscount = true -%}
    {%- endif -%}

    Screen Shot 2020-12-11 at 3.46.57 AM.png

    1. (part where I added code is in a burgundy color)
    First Name *8 characters only*
    Birthday Number *1 character only*

    {% if section.settings.show_quantity_selector %}

    {{ 'products.product.quantity' | t }}
    {% endif %}