Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
I can add a product variant to my cart with a hyperlink:
https://mywebsite.com/cart/add?id= {{ item.id }}&quantity=1
BUT
Can I remove a product variant from my cart with a similar hyperlink?
https://mywebsite.com/cart/remove?id={{ item.id }}&quantity=1
Solved! Go to the solution
This is an accepted solution.
GOT IT! Here is how I made a " -1 button and +1 button" for my cart which reloads the page when you press them.
THE RESTRICTION: this only works inside of the cart
<!-- minus 1 button -->
<a href="/cart/change?line={{ forloop.index }}&quantity={{ item.quantity | minus: 1 }}>
-1 button
</a>
<!-- displays item quantity -->
{{ item.quantity }}
<!-- plus 1 button -->
<a href="/cart/add?id= {{ item.id }}&quantity=1">
+1 button
</a>
Additionally, I was able to make a dropdown quantity selector for my cart that reloads the page.
<!-- dropdown quantity selector that reloads page -->
<select>
<option value="" disabled selected hidden>{{ item.quantity }}</option>
<option value="/cart/change?line={{ forloop.index }}&quantity=1"> 1</option>
<option value="/cart/change?line={{ forloop.index }}&quantity=2"> 2</option>
</select>
EDIT: even though I created an acceptable workaround solution, I would still like to have my original question be solved, so that I can put a "-1 item from cart" button anywhere on my website, not just having it be limited/confined to the cart.
This is an accepted solution.
GOT IT! Here is how I made a " -1 button and +1 button" for my cart which reloads the page when you press them.
THE RESTRICTION: this only works inside of the cart
<!-- minus 1 button -->
<a href="/cart/change?line={{ forloop.index }}&quantity={{ item.quantity | minus: 1 }}>
-1 button
</a>
<!-- displays item quantity -->
{{ item.quantity }}
<!-- plus 1 button -->
<a href="/cart/add?id= {{ item.id }}&quantity=1">
+1 button
</a>
Additionally, I was able to make a dropdown quantity selector for my cart that reloads the page.
<!-- dropdown quantity selector that reloads page -->
<select>
<option value="" disabled selected hidden>{{ item.quantity }}</option>
<option value="/cart/change?line={{ forloop.index }}&quantity=1"> 1</option>
<option value="/cart/change?line={{ forloop.index }}&quantity=2"> 2</option>
</select>
Where in theme code does this go?
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