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!
Shopify and our financial partners regularly review and update verification requiremen...
By Jacqui Mar 14, 2025Unlock the potential of marketing on your business growth with Shopify Academy's late...
By Shopify Mar 12, 2025Learn how to increase conversion rates in every stage of the customer journey by enroll...
By Shopify Mar 5, 2025