<blockquote>
  <p>Is it as simple as changing the input to a submit (or button submit)
  using the same name tag contents?</p>
</blockquote>

<p>Yes.</p>

<blockquote>
  <p>Would this then also carry over to be posted via ajax in the same way
  as an update-cart action?</p>
</blockquote>

<p>Yes.</p>

<p>Everything can be done on a single line item basis to the update-cart acton, just use the new param names.</p>

CC BY-SA 4.0
2018-07-26T02:33:22.207Z
Should have just tested before asking, but was away. Anyway... I know multiple submits in a form is a little iffy in older browsers, however as long as the name is different it certainly works across modern browsers. How would one go about wrapping each remove submit within one ajax function? Javascript is typically where I trip up in spaghetti with these types of things. I essentially want to keep the update cart submit for discount codes and so on, but have each individual remove (or +/- to change quantity) to go through the same form and ideally the same ajax function. 
Anders
CC BY-SA 4.0
2018-07-26T00:45:13.410Z
2018-07-26T00:45:13.410Z
Luke Holder
<p>Knowing that all other actions besides update-cart has been deprecated I'm curious what needs to be passed with the action to remove a line item from the cart using a button as opposed to <code>check a checkbox &gt; update cart</code> (essentially removing a click for the user). 
The same would apply for +/- buttons/inputs for adding/removing from quantity.</p>

<p>I see in the example templates there's a checkbox input with <code>name="lineItems[{{ item.id }}][remove]"</code>. Is it as simple as changing the input to a submit (or button submit) using the same name tag contents? Would this then also carry over to be posted via ajax in the same way as an update-cart action?</p>

<p>That's a long question. Trying to wrap my head around the changes as I'm just getting into Craft 3 and Commerce 2...</p>

<plugin-craftcommerce><craft3><plugin-craftcommerce2>
Craft Commerce 2 — Remove Line Item (and other actions)
# Craft Commerce 2 — Remove Line Item (and other actions)

(Asked by: username_0 on 2018-07-25)

Knowing that all other actions besides update-cart has been deprecated I'm curious what needs to be passed with the action to remove a line item from the cart using a button as opposed to `check a checkbox > update cart` (essentially removing a click for the user).
The same would apply for +/- buttons/inputs for adding/removing from quantity.

I see in the example templates there's a checkbox input with `name="lineItems[{{ item.id }}][remove]"`. Is it as simple as changing the input to a submit (or button submit) using the same name tag contents? Would this then also carry over to be posted via ajax in the same way as an update-cart action?

That's a long question. Trying to wrap my head around the changes as I'm just getting into Craft 3 and Commerce 2...

**Tags:** plugin-craftcommerce, craft3, plugin-craftcommerce2

---

## 1 answers

### Answer by username_1 on 2018-07-26. Score: 1 | Accepted answer

> Is it as simple as changing the input to a submit (or button submit)
> using the same name tag contents?

Yes.

> Would this then also carry over to be posted via ajax in the same way
> as an update-cart action?

Yes.

Everything can be done on a single line item basis to the update-cart acton, just use the new param names.

> **Comments:**
> **username_0**: Should have just tested before asking, but was away. Anyway... I know multiple submits in a form is a little iffy in older browsers, however as long as the name is different it certainly works across modern browsers. How would one go about wrapping each remove submit within one ajax function? Javascript is typically where I trip up in spaghetti with these types of things. I essentially want to keep the update cart submit for discount codes and so on, but have each individual remove (or +/- to change quantity) to go through the same form and ideally the same ajax function.   

---

