Shopify themes, liquid, logos, and UX
I want to change the functionality of remove button in cart page.
when i am deleting the product it should not refresh the page. right now its refreshing the page.
this is the code from cart.liquid file
<tbody class="order-summary__body">
{%- for line_item in cart.items -%}
{%- assign line_max_quantity = '' -%}
{%- if line_item.variant.inventory_management != blank and line_item.variant.inventory_policy == 'deny' -%}
{%- assign line_max_quantity = line_item.variant.inventory_quantity -%}
{%- endif -%}
<tr>
<td>{%- render 'line-item', line_item: line_item -%}</td>
<td class="hidden align-center text-center text-subdued sm:table-cell">
<line-item-quantity class="v-stack justify-center gap-2">
<input class="quantity-input" type="text" is="quantity-input" inputmode="numeric" {% if line_max_quantity != blank %}max="{{ line_max_quantity }}"{% endif %} data-line-key="{{ line_item.key }}" aria-label="{{ 'cart.order.change_quantity' | t | escape }}" value="{{ line_item.quantity }}">
<span class="text-xs">
<a href="{{ line_item.url_to_remove }}" class="link">{{ 'cart.order.remove' | t }}</a>
</span>
</line-item-quantity>
</td>
<td class="hidden align-center text-subdued text-end sm:table-cell">{{ line_item.final_line_price | money }}</td>
</tr>
{%- endfor -%}
</tbody>
Hi @Prince1995
It will require some knowledge of JS and shopify liquid to do it
instead of using href with cart remove link, you can put simple button and use cart change.js and put this line quantity to zero and after that refresh the cart content using ajax, so it is somewhat long process, this is just an idea how you can do it
Thanks!
Hey Community 👋 Did you know that March 15th is National Everything You Think Is W...
By JasonH Apr 1, 2025Discover how to increase the efficiency of commerce operations with Shopify Academy's l...
By Jacqui Mar 26, 2025Shopify and our financial partners regularly review and update verification requiremen...
By Jacqui Mar 14, 2025