I'm working on a site that has recently migrated from Craft v2 with Commerce v1 to Craft v3 with Commerce v2.
Using Commerce v1 I was able to update the cart via Ajax and get a data object with the state of the cart as a response.
After updating to Craft Commerce v2 the ajax requests fail, returning Status 302 - Redirect
instead of the data object, although the changes to the cart are successful.
I can add one or more products or change their quantity via Ajax, however, I need the data object in order to properly update the state of the cart without reloading the page.
- I'm running Craft
v3.0.10.2
with Craft Commerce fromdev-develop
commit1db58f6
on a machine running PHPv7.1.12
- The action I'm using is
commerce/cart/update-cart
- The method of all requests is
POST
- Any form data should to be ok since the cart updates succesfully
- All requests are sent with the following headers:
Content-Type: application/x-www-form-urlencoded; charset=UTF-8 X-Requested-With: XMLHttpRequest
I'm I missing anything new in CC2? Any help would be much appreciated.