CoCart v4 Beta 2 is ready for download and testing.
This version of the CoCart software is under development. Please do not install, run, or test this version on production or mission-critical websites.
FYI: This post will focus on the Cart API experience but will list changes or additions to the Sessions API and WordPress dashboard.
Highlights
Since the release of 4.0.0-beta.1, the following changes have been made:
- Fixed critical bugs with the help of a contributor Viktor Szépe.
- A name change for the salt key used in the headers. Was previously
csaltk
but changed tox-cocart-salt
to be more consistent for developers. - Corrected access to the CoCart logger in the cart API in v1.
- Prevent redirect if request method is HEAD when access to WordPress is blocked.
- Corrected clearing the cart due to session handling changes.
- Merged any missing updates already released before v4
- Changed price parameter and value
preformatted
toformatted
. - Prevent CoCart Pro from being listed with CoCart add-ons on the plugins page.
The main change made is expanding on how the fields are controlled giving you more options and improve the out of the box experience.
The change now makes it possible to add more default configurations to the settings page this time for the Cart API.

We wanted to provide the ability to set the fields you want to return by default without manually setting a parameter to the cart endpoint. This affects the cart response for all cart endpoints.
With the cart response given a set of fields already to return, you can use the fields
parameter to further optimize what you want to return or not return with a new parameter added exclude_fields
.
To make this adjustment possible we had to move up the config parameters to be singular parameters. This is simply due to the limits of the server class in WordPress when it comes to handling default values for parameters.
We also added a new response option to return a mini cart configuration. This returns just the currency, items and cart subtotal only.
Understandably the items returns a lot of data so we improved the field filtering there too so when you request a mini cart, it will only return the following for items:
- Item Key
- Title
- Price
- Quantity
- Product Image
That said, you can filter the fields for items too now.
Here is an example of only returning the fields above for items.
curl -L 'https://myawesome.store/wp-json/cocart/v2/cart?fields=items.item_key,items.title,items.price,items.quantity.value,items.featured_image'
Action and Filters
This release adds one new filter and no new action.
Filter | Description |
---|---|
cocart_cart_fields_for_request | Filter allows you to set the fields for the request returning. |
Database Changes
This release has no database changes.
Release Schedule
We’re pushing the final release back a few days to 18th August, 2023.
Your help testing this version ensures everything in this release is the best and ready to move to a release candidate on Tuesday 15th August, 2023.
Testing
Testing for issues is a critical part of developing any software, and it’s a meaningful way for anyone to contribute—whether you have experience or not.
While testing the upgrade process is essential, testing new features is too. Review the changes listed above and focus your testing efforts on those areas in particular.
If you discover any bugs during the testing process, please let us know by logging a report in GitHub.
Get CoCart 4.0 Beta 2
You can test CoCart 4.0 Beta 2 in two ways:
- Option 1: Install and activate the CoCart Beta Tester plugin (select the “Beta Releases” channel if not all ready) and update the plugin. (Must already have stable plugin installed.)
- Option 2: Direct download the Beta 2 version (zip).
Help translate CoCart
Do you speak a language other than English? ¿Español? Français? Português? Русский? 日本? Help translate CoCart into more than 100 languages.
One reply on “CoCart v4 Beta 2 Release Notes”
Did some more testing on a clean WordPress install. Default setting is broken so the cart doesn’t return. Everything else is fine. Just a small hiccup that I am fixing for the next beta. This is why we have beta’s. LOL