Hello,
We need a help with remove button in a cart drawer. To delete a product row. Theme: Impulse.
A Shopify store owner using the Impulse theme needs help implementing a functional remove button for individual cart drawer items.
Current Situation:
Code Implementation:
Troubleshooting Attempts:
<a href="/cart/change?line={{forloop.index}}&quantity=0" rel="{{item.id}}">Remove Item</a>Current Status:
Hello,
We need a help with remove button in a cart drawer. To delete a product row. Theme: Impulse.
{%- assign img_url = product | img_url: '1x1' | replace: '_1x1.', '_{width}x.' -%}
{{ product.product.title }}
{%- unless product.product.has_only_default_variant -%}
{%- for option in product.options_with_values -%}
{{ option.name }}: {{ option.value }}
{%- endfor -%}
{%- endunless -%}
{%- if product.selling_plan_allocation != empty -%}
{{ product.selling_plan_allocation.selling_plan.name }}
{%- endif -%}
{%- assign property_size = product.properties | size -%}
{% if property_size > 0 %}
{% for p in product.properties %}
{%- assign first_character_in_key = p.first | truncate: 1, '' -%}
{% unless p.last == blank or first_character_in_key == '_' %}
{{ p.first }}:
{% if p.last contains '/uploads/' %}
{{ p.last | split: '/' | last }}
{% else %}
{{ p.last }}
{% endif %}
{% endunless %}
{% endfor %}
{% endif %}
{{ 'cart.general.remove' | t }}
{% if product.original_price != product.final_price %}
{{ 'products.general.regular_price' | t }}
<small>
{{ product.original_price | money }}
</small>
{{ 'products.general.sale_price' | t }}
{{ product.final_price | money }}
{% else %}
{{ product.original_price | money }}
{% endif %}
{%- if product.line_level_discount_allocations != blank -%}
{%- for discount_allocation in product.line_level_discount_allocations -%}
<small>{{ discount_allocation.discount_application.title }} (-{{ discount_allocation.amount | money }})</small>
{%- endfor -%}
{%- endif -%}
{%- if product.unit_price_measurement -%}
{%- capture unit_price_base_unit -%}
{%- if product.unit_price_measurement -%}
{%- if product.unit_price_measurement.reference_value != 1 -%}
{{ product.unit_price_measurement.reference_value }}
{%- endif -%}
{{ product.unit_price_measurement.reference_unit }}
{%- endif -%}
{%- endcapture -%}
{{ product.unit_price | money }}/{{ unit_price_base_unit }}
{%- endif -%}
It fits good but after clicking a remove button I am getting an error and it does not delete.
IT fits good but I am getting an error after clicking on it
{%- assign img_url = product | img_url: '1x1' | replace: '_1x1.', '_{width}x.' -%}
{{ product.product.title }}
{%- unless product.product.has_only_default_variant -%}
{%- for option in product.options_with_values -%}
{{ option.name }}: {{ option.value }}
{%- endfor -%}
{%- endunless -%}
{%- if product.selling_plan_allocation != empty -%}
{{ product.selling_plan_allocation.selling_plan.name }}
{%- endif -%}
{%- assign property_size = product.properties | size -%}
{% if property_size > 0 %}
{% for p in product.properties %}
{%- assign first_character_in_key = p.first | truncate: 1, '' -%}
{% unless p.last == blank or first_character_in_key == '_' %}
{{ p.first }}:
{% if p.last contains '/uploads/' %}
{{ p.last | split: '/' | last }}
{% else %}
{{ p.last }}
{% endif %}
{% endunless %}
{% endfor %}
{% endif %}
{{ 'cart.general.remove' | t }}
{% if product.original_price != product.final_price %}
{{ 'products.general.regular_price' | t }}
<small>
{{ product.original_price | money }}
</small>
{{ 'products.general.sale_price' | t }}
{{ product.final_price | money }}
{% else %}
{{ product.original_price | money }}
{% endif %}
{%- if product.line_level_discount_allocations != blank -%}
{%- for discount_allocation in product.line_level_discount_allocations -%}
<small>{{ discount_allocation.discount_application.title }} (-{{ discount_allocation.amount | money }})</small>
{%- endfor -%}
{%- endif -%}
{%- if product.unit_price_measurement -%}
{%- capture unit_price_base_unit -%}
{%- if product.unit_price_measurement -%}
{%- if product.unit_price_measurement.reference_value != 1 -%}
{{ product.unit_price_measurement.reference_value }}
{%- endif -%}
{{ product.unit_price_measurement.reference_unit }}
{%- endif -%}
{%- endcapture -%}
{{ product.unit_price | money }}/{{ unit_price_base_unit }}
{%- endif -%}
You will also have code for the normal cart page (not drawer). Could you paste the code for that. We Can use the logic from that page to your drawer.
{%- render 'breadcrumbs' -%}
{%- if cart.item_count > 0 -%}
{%- endif -%}
{% schema %}
{
"name": "t:sections.main-cart.name"
}
{% endschema %}
Can you try the following code to remove it, please?
By using this code down below. After I click remove on cart drawer it sends me to cart page and from there I can delete an item.
It’s a workaround. Sorry couldn’t help you with an easier solution.
It seems that this code is removing an item row in cart page. It is strange that there is no button on cart drawer.
{{ 'cart.general.remove' | t }}