CoCart v4 Beta 2 Release Notes

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:

  1. Fixed critical bugs with the help of a contributor Viktor Szépe.
  2. A name change for the salt key used in the headers. Was previously csaltk but changed to x-cocart-salt to be more consistent for developers.
  3. Corrected access to the CoCart logger in the cart API in v1.
  4. Prevent redirect if request method is HEAD when access to WordPress is blocked.
  5. Corrected clearing the cart due to session handling changes.
  6. Merged any missing updates already released before v4
  7. Changed price parameter and value preformatted to formatted.
  8. 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.

Settings page for CoCart API
Settings page showing the options 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.

FilterDescription
cocart_cart_fields_for_requestFilter 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:

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.