CoCart 4.1.0 has been released!
This post will highlight what’s included in this version of CoCart Core.
Download directly from WordPress.org.
Other important information:
- This release added more inline documentation for action hooks and filters.
- This release fixes the issue with most product endpoints for API v2 not registering since v4.0.
- This release removed the legacy API that CoCart started with.
- This release does not include a database change.
About:
- Backwards compatible
- Tested up to WordPress 6.5
- Tested up to WooCommerce 8.9
Hi, folks! This release is all about adding quality of life improvements and more freedom to customize and support CoCart. You should defiantly checkout the code base on our GitHub repository for more inline documentation added. New filters and action hooks have also been introduced.
We also did some cleaning up. We have a few deprecations in this release. First is that we have removed the legacy API that CoCart started with and removed support for stores running lower than WooCommerce version 4.5.
Two hooks have also been replaced, the cart response can now be filtered further with the addition of two new parameters and fixed an issue where the majority of the product endpoints where not registering since v4.0.
What’s New in CoCart v4.1?
We added a new cart callback that allows you to set the customers billing details. This is late I know but please understand that decoupling is not easy and previous attempts to add customer information to the cart was not sticking until now. Better late than never.
Basic Authentication now accepts a customers billing phone number as their username. Password is still required when authenticating.
And last, added the ability to set the customers billing phone number while adding items to the cart.
Improvements
Various other improvements have also been made affecting support for authentication, custom pricing, calculating totals, product details and more.
- Plugin: Should the session not be initialized when called, it now fails safely.
- REST API: Authentication now detectable by authorization headers
HTTP_AUTHORIZATION,REDIRECT_HTTP_AUTHORIZATIONorgetallheaders()function. - REST API: Re-calculating cart totals has moved to the abstract cart callback so it can be shared.
- REST API: Setting a custom price for an item will now return that price for the item not just update the subtotals and totals.
- REST API: When adding an item to cart with a custom price, check if the product allows it to change.
- REST API: Stock details now return for variations in the Products API (V2 Only). Schema updated to match.
- REST API: Added headers
CoCart-API-Cart-ExpiringandCoCart-API-Cart-Expirationto be exposed with CORS. - REST API: Browser cache has been improved.
Deprecations
- No longer use
cocart_override_cart_itemfilter. Recommend usingcocart_item_added_to_cartaction hook instead. - No longer user
cocart_cart_updatedhook. Replaced withcocart_update_cart_before_totalshook.
Developers
For developers we added new filters and action hooks that where made possible with the improvements added in this release.
| Filters | Description |
|---|---|
cocart_auth_header | Allows you to change the authorization header. |
cocart_set_customer_id | Allows you to set the customer ID before initialized. |
cocart_available_shipping_packages | Allows you to alter the shipping packages returned. |
cocart_does_product_allow_price_change | Allows you to deny all custom prices or on specific items. |
| Hooks | Description |
|---|---|
cocart_after_item_added_to_cart | Allows for additional requested data to be processed once item has added to the cart. |
cocart_after_items_added_to_cart | Allows for additional requested data to be processed once items are added to the cart. |
cocart_update_cart_before_totals | Fires before the cart has updated via a callback. |
cocart_update_cart_after_totals | Fires after the cart has updated via a callback. |
That’s it. As always, the best it yet to come and your feedback is welcomed. If you have any suggestions to improve CoCart, please submit them here.


