CoCart 4.0 Released: Now with cart batch support, and more

CoCart 4.0.0 has been released!

This post will highlight what’s included in this version of CoCart Core.

Download directly from

Other important information:

  • This release requires quantity value to be passed as a string.
  • This release fixed various text localization issues.
  • This release does not include a database change.


  • Backwards compatible, 99%
  • Tested up to WordPress 6.5
  • Tested up to WooCommerce 8.8

Hi, folks! This release is not the version 4 you hoped to be, for those who have been following it’s development, but it had to happen this way. But don’t lose hope, while this release took a bit of time to provide we do have something new added hence why this is the new version 4 release.

Each chosen improvement had to be carefully migrated over from the originally planned v4 release due to major code structure changes to ensure the highest quality and stability.

The entire code base has also been improved to meet the WordPress Code Standards, so that it can stay freely available in the WordPress plugin directory.

We also invite you to read our Security Policy page should you feel that you have found a security issue with the code.

What’s New in CoCart v4.0?

This release only has 1 new feature added and that is batch support for the car endpoints. I know, it’s huge, but keep reading for details.

Please know that it’s only supported for API v2. This is because API v2 is more stable and reliable for the cart endpoints to return data correctly when requesting multiple cart endpoints.

Wait, didn’t you say cart batch support will be premium feature now? Yes we did. Our true cart batch support is still going to be a premium feature. What you get for free now is technically just enabling batch support to the cart API endpoints (listed below), using the default WordPress method of batch usage.

WordPress batch will return the response of each API request made which is not the experience we wanted for developers. Our premium cart batch feature (still in development) runs the batch requests and then merges all the cart data from each request and returns one true complete cart response. Making it easy for developers to utilize.

So for now we hope you appreciate having the standard WordPress way of using batch with CoCart. We look forward to notifying the release of the premium version of cart batch support in the future.

Cart endpoints supported for batch requests.

  • Add item/s to cart.
  • Clear cart.
  • Remove item.
  • Restore item.
  • Update item.
  • Update cart.

Bug Fixes

  • Plugin: Fixed various text localization issues.
  • REST API: Access-Control-Allow-Credentials being outputted as 1 instead of true. Solves issue 410. Thanks to @SebastianLamprecht for reporting it.
  • REST API: Update cart requests no longer fails and continues to the next item if an item in cart no longer exists.
  • REST API: Products API schema has been completed for v1.
  • REST API: Products API schema has been corrected for v2.
  • WordPress Dashboard: Plugin suggestions now lists CoCart JWT Authentication add-on.


  • REST API: Now checks if the request is a preflight request.
  • REST API: Error responses are now softer to prevent fatal networking when a request fails.
  • REST API: Callback for cart update now passes the cart controller class so we don’t have to call it a new.
  • REST API: Cart schema tweaks for API v2.
  • REST API: Cart and Product schema are now cached for performance for API v2.
  • Plugin: Added more inline documentation for action hooks and filters.
  • Plugin: Improved database queries.
  • Plugin: Updated to latest WordPress Code Standards.
  • WordPress Dashboard: Added CoCart add-on auto updates watcher.
  • WP-CLI: Updating CoCart via command will now remove update database notice.


Two new headers return for cart responses only. CoCart-API-Cart-Expiring and CoCart-API-Cart-Expiration

These two new headers can help developers use the timestamps of the cart in session for when it is going to expire and how long until it does expire completely.

Error tracking now returns with the error responses when WP_DEBUG is set to true to help with any debugging.

For those who access the REST API controllers with their projects, we have added Class aliases to API v2 controllers after changing the class names for consistency.

One response to “CoCart 4.0 Released: Now with cart batch support, and more”

  1. Sébastien Avatar

    Update: One thing I forgot to mention is that the quantity parameter for both adding an item and updating an item must now be passed as a string but will still validate if the string value is a numeric or float value. This is because of the OpenAPI Spec I am working on doesn’t understand float as a type.

    Just make sure that the value is passed as a string instead and it works just as before.

Leave a Reply