302 redirect when updating the cart via Ajax using Craft Commerce 2
The function contains this

if ($request-&gt;getAcceptsJson()) {


Thus you'll need to set the dataType in your ajax request to json or text/json in order to not get redirected. If you didn't set it correctly Craft will treat it as a normal post request instead of an ajax request