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!
Learn how to build powerful custom workflows in Shopify Flow with expert guidance from ...
By Jacqui May 7, 2025Did You Know? May is named after Maia, the Roman goddess of growth and flourishing! ...
By JasonH May 2, 2025Discover opportunities to improve SEO with new guidance available from Shopify’s growth...
By Jacqui May 1, 2025