CoCart v3 Release Notes

I’m pleased to announce CoCart v3 is now available. It’s my biggest release yet for CoCart and may be a while before I release any further updates as I get CoCart Pro ready for it’s next big update.

This release brings a new API providing more than before. Thanks to the amazing feedback from users, CoCart v3 brings a much better cart response designed for all with an all-new flow experience, new options and support for developers to utilize.

Adding grouped products is also now possible while adding variable products has become simpler. Error validation has also be improved so even the smallest of errors caused, a developer can get a clear explanation as to what went wrong.

Basic authentication is also now built in with additional support for use of email address for the username. So you don’t have to use the JSON Basic Authentication plugin no more which is also outdated.

Updating to the new API is simple and makes building your headless store easier than before. Most parameters are the same, other parameters have changed for the better including the default values.

Simply follow the upgrade guide and your good to go.

If your not new to CoCart I think your going to love this update. If you are new to CoCart, well I can already feel your smile of appreciation. ☺

What’s New with CoCart v3?

  • 🥇 NEW: API v2 with new routes to help with the flow.
  • 💯 NEW: Better cart response based on the experimental free add-on “Get Cart Enhanced“.
  • ⛓️ NEW: Carts can sync for guest customers between app and web once “Load Cart from Session” feature has been used.
  • 🔑 NEW: Basic Authentication now built in with the ability to authenticate via email instead of username. 🥳
  • 🔒 NEW: Each route can be forced to check if the user (meaning only a logged in user) has permission to use the API. This requires the use of a new filter. See article for more information.
  • 🔎 NEW: Browse and Search CoCart add-ons or supported extensions from the plugin install page.
    • Search suggestions are added at the bottom of the plugin search results on the first page only if matching key words match.
    • New plugin install section “CoCart” displays information on available add-ons or supported extensions with compatibility information and links to more details.
  • 🧾 NEW: Support for TaxJar for WooCommerce plugin if you have v3.2.5 or above.
  • 🚢 NEW: Support for WooCommerce Advanced Shipping Packages extension.
  • 🎁 NEW: Support for WooCommerce Free Gift Coupons extension.
  • 🗝️ NEW: Support for JWT Auth plugin by Useful Team.
  • 🌗 NEW: Compatible with WP-GraphQL WooCommerce add-on.
  • Tweaked: Session data now handled by new abstract to gain more control over it.
  • Tweaked: Cart key now returns in the cart response the first time round. 🥳
  • Tweaked: The loading of the session handler for better initialization by filtering it outside the action hook woocommerce_loaded.
  • Tweaked: Loading a cart from session is now prevented if a user is already logged in.
  • Tweaked: Loading a cart from session is now prevented if a user is not logged in and the cart key requested matches any registered user.
  • Tweaked: Cart session now stores when the cart was created, it’s source and hash.
  • Tweaked: WooCommerce System Status Tools are made available even if COCART_WHITE_LABEL is set to true.
  • Deprecated: Redirect to cart after using load cart from session.
  • Tested: ✔️ Compatible with WooCommerce v5.3
  • Dev: 🐸 NEW Update database manually for CoCart via WP-CLI.
  • Dev: 🐸 NEW Get the current version of CoCart via WP-CLI.
  • Dev: Forked get_customer_unique_id() from WooCommerce session handler for backwards compatibility. Introduced to help with unit tests in WooCommerce since version 5.3. Not needed for CoCart.

There is a whole lot of action filters and hooks now available which you can view in the full changelog.

View the full changelog here.

Minimum Requirements

PHP requirement has been bumped to v7.3 to ensure you are getting the best of CoCart. However, web hosts will soon be updating the default PHP version to v7.4 and deprecating support for PHP 7.3 and below. CoCart v3 is ready for that.

Documentation changes

New documentation for v3 is available so you can get stuck into using the new release asap. Wish to access documentation for the previous API version?

Database changes

This release does introduce changes to the CoCart session table to store when the cart was created, it’s source and cart hash.

If you have been keeping CoCart up to date until now then you will have no issues upgrading when your ready.

Just another warning encase you missed the first one.

If you have not updated CoCart to at least v2.9 then I must warn you. If you have large stores and you update CoCart directly to v3 ignoring previous patches, then the database upgrade will run automatically in the background without notice.

So please update to v2.9 before updating to v3 for a smoother upgrade process.

Support your extension for the new CoCart API

With CoCart v3 near a code freeze, I’m excited to share that the new API is more connected to the front-end of WooCommerce than before.

New matching filters are included for the cart response so you can connect any of the filters you may have already used in your WooCommerce extension to filter the cart template to do the same for CoCart.

For example, your extension may have changed how the subtotal displays in the cart using woocommerce_cart_item_subtotal.

The same can be done for CoCart using cocart_cart_item_subtotal returning the same results and using the same arguments the filter uses.

This enables your extension to be compatible no matter what the store owner decides to use. Its that simple and only one additional line of code is required.

Take WooCommerce Free Gift Coupons extension for example. All that is required for the subtotal to match via the REST API is to apply the matching filter like so.

add_filter( 'cocart_cart_item_price', array( 'WC_Free_Gift_Coupons', 'cart_item_price' ), 10, 2 );

Matching filters

WooCommerce FilterCoCart Filter
woocommerce_cart_item_namecocart_cart_item_name
woocommerce_cart_item_pricecocart_cart_item_price
woocommerce_cart_item_quantitycocart_cart_item_quantity
woocommerce_cart_item_subtotalcocart_cart_item_subtotal
All filters use the same arguments and are in the same order.

If you need any assistance, you can join me and other developers in the CoCart Community via Slack.

I look forward to seeing more WooCommerce extensions supporting CoCart.

P.S. Not all matching filters can just be placed, some results may have to return formatted a little differently depending on how you have developed your extension for that particular area.

CoCart Lite v2.8.3 Release Notes

Excited to announce that CoCart Lite 2.8.3 is now publicly available! This is a minor release so everything is backwards compatible with the previous version.

As always, it is recommend to create a backup of your site before updating.

What’s new in CoCart v2.8.3?

This is the last minor update for CoCart v2 or at least for this year I think.

What’s new is that multi-site networks now properly engage with the site admin once the plugin is activated on the network.

A few tweaks have been made so we don’t add the version of the plugin per site. All admin notices now show via the network admin and if you are new to CoCart, you are redirected to the getting started page in the network admin upon first activation.

Before network sites would only see “Plugin activated” which makes the site admin feel left out.

A couple of fixes were also made.

Headers were already sent when filtering rest_pre_serve_request. This appeared to only cause issues when you have WP_DEBUG enabled when using CoCart locally.

And finally, a few errors were not returning the status error in the correct format.

That is it. I hope you are doing well and have a good x-mas. ?

Database changes

This release does not introduce any changes to the database.

Documentation

This release does not introduce any changes to the documentation.

CoCart Lite v2.8.2 Release Notes

Excited to announce that CoCart Lite 2.8.2 is now publicly available! This is a minor release so everything is backwards compatible with the previous version.

As always, it is recommend to create a backup of your site before updating.

What’s new in CoCart v2.8.2?

Two things have been done to improve the loading of a cart from session via the web. Load the chosen shipping method and cart fees.

In addition to this minor release, a request was made to be able to filter the parameter name cocart-load-cart, used for loading the cart from session via the web to provide more white labelling for their client.

You can find an example for this filter under “White Labelling”.

Database changes

This release does not introduce any changes to the database.

Documentation

All examples provided for setting a cart key have been corrected. Due to an over look on my part, I mistakenly documented the cart_key parameter as a standard data parameter and not a global parameter that requires to be queried.

Not many developers who had issues with this, saw the error and corrected this in their development but not reported the error to me.

Others had tried to report the error but did not make it clear to me as to what was wrong and moved on. Now after several releases and finally getting someone to report clearly what was wrong, I was able to correct it.

I apologise for the mistake and hope you try again with the new examples provided. I have also added a warning notice in the documentation to remind you that it is not to be passed as a data parameter.

CoCart Lite v2.8.1 Release Notes

Excited to announce that Pantheon, a high performance hosting platform is now supported in CoCart Lite 2.8.1 which is now publicly available! This is a tiny release so everything is backwards compatible with the previous version.

As always, it is recommend to create a backup of your site before updating.

What does it do?

Well because Pantheon is a platform built for speed, it’s cache system caused a problem for guest customers on the frontend making it look like the cart was empty no matter how many items were added to the cart.

Luckily, this was a quick easy fix after talking to their customer service.

All that was required was to change the cookie name using the available filter in CoCart to a new formatting that Pantheon reorganizes to prevent the session cookie from caching.

And after trying them out, I can say that I recommend using Pantheon for speedy performance to run your store no matter how large.

Database changes

This release does not introduce any changes to the database.

Documentation

This release does not introduce any changes to the documentation.

CoCart Lite v2.8 Release Notes

Excited to announce that CoCart Lite 2.8 is now publicly available! This is a minor release so everything is backwards compatible with the previous version.

As always, it is recommend to create a backup of your site before updating.

What’s new in CoCart v2.8?

Only one small enhancement was made for the load cart from session for the web feature and that is to load the chosen shipping method.

Compatibility

As always there will be releases that add compatibility for changes made in WooCommerce. This time being mainly with WooCommerce v4.8 and WooCommerce Admin v1.7

Minimum requirement changes

These are the new minimum requirements in order to run CoCart. This ensures that new features added to CoCart work with these minimum requirements and the latest WordPress and WooCommerce releases error free.

  • WordPress now needs to be v5.3 minimum.
  • WooCommerce now needs to be v4.3 minimum.

Support for CoCart Lite will not be provided for sites running any lower than these minimum requirements.

In the future the minimum requirement for PHP will be bumped from 7.0 to 7.3

PHP 8 was released last week and so far there has been no issues reported which is great and works really fast which is what you need for a REST API.

Database changes

This release does not introduce any changes to the database.

Documentation

This release does not introduce any changes to the documentation.