WooCommerce 2.6 will include a new feature for the Shopping Cart: AJAX calls. This includes functionality for:
- Updating cart quantities
- Applyingย and removing coupons
- Updating shipping options
Check out this video to see 2.5 and 2.6 side-by-side:
What does this mean for users?
The page looks exactly the same as before, so users familiar with the cart will be just fine. The main difference is in performance and no more page reloads for updates. Now, when you do any of the update operations above, instead of reloading the entire page, the cart will first show a spinner over the updating areas, then update within those areas on the page.
What does it mean for developers and designers?
Actually, other than a better user experience, very little. This update was designed with backward compatibility as a primary concern. Existing themes should work just fine still and existing server-side actions/filters as well. In fact, no server code was changed with this update. The JavaScript naturally depends on certain HTML IDs and CSS classes for selectors, so be careful if you start to use those class names elsewhere in your themes.
Where are the technical details?
The vast majority of code for this was updated in the cart.js file. Feel free to take a look there. For the Coupon update code, the API was used, but for the larger updates, the original form submit handling on the server is employed to make sure that the behavior matches the existing cart functionality as much as possible.
Leave a Reply