Coming in v2: Responses

Getting the correct returned response are important when using the REST-API so providing the option to return the whole cart without the need to call it again is also important.

Now when you add an item to the cart, update item quantity, remove item or restore an item. You can now return the whole cart contents rather than the default response if requested.

For e.g. by default when adding an item to cart, only that item would return it’s details. So before that happens if the return cart parameter is used, the whole of the cart is instead returned with that added item.

Pretty sweat right!

I’m sure developers will find this useful. What do you think of this improvement coming?

Version 2 is still in development so please come back for more news as it develops.

Thank you.

Coming in v2: Getting the Cart

I thought I share some more news on what is coming to v2 of CoCart. Progress is being made the project is not dead though with the release of v3.6 of WooCommerce I thought it was going to be but that was solved quickly.

Now one popular request was to get a specific customers cart. I thought this might be a difficult challenge maybe by creating a new cart table in the database but it turns out WooCommerce already has a feature that is probably only known to those who read the whole of the WooCommerce source code.

So those with administrator capabilities can now add a new parameter for the customers ID number. When called it will get the cart contents from that specific customer from when they were logged in last. I don’t see any other user role that would need to access a customers cart. Feel free to comment below if you feel otherwise.


However, this feature will only work if the site owner has left persistent cart enabled and the session has not cleared or expired. If no cart data is stored for that customer it will fallback to the cart in use.

On top of that I have also applied a filter that allows you to apply additional information to return for the items in the cart.

Version 2 is still in development so please come back for more news as it develops.

Thank you.

Coming in v2: The Endpoint

CoCart version 2 is currently in development and I wanted to give you all a heads up on one core change coming to CoCart and that is the endpoint.

Currently, the API migrates under WooCommerce’s API. At the time of CoCart’s early development, the WooCommerce API was version 2. Now WooCommerce’s API is on version 3.

I have not updated the version CoCart is nested under for two reasons.

  1. WooCommerce API version 2 still works fine with CoCart.
  2. I did not want users of CoCart to change the API endpoint again in their site or app projects once version 2 of CoCart is available.

For CoCart to evolve the API endpoints need to move out of WooCommerce’s API and get its own place. This will also help to keep compatibility with WooCommerce and increase the strength of the code for the future.

When version 2 is released, there is no need to worry about making any changes to your site or app using CoCart straight away as the current API will still be supported as a legacy API but when you have the chance to switch over to the new API, I highly recommend that you do so, especially if you are going to be using CoCart Pro once it is released.

The current API endpoint is like so:

When version 2 is made available, the new endpoint will be like so:

API Differences

The API its self does not currently have anything new so there is no current change but with this move made it will allow CoCart to support additional features making CoCart a product of its own rather than just a supported extension to WooCommerce’s API.

The API version will also be reset back to v1 and development will focus on stability before adding support for other product types provided by WooCommerce extensions.

Any specific changes made to the API will be made available via documentation.

This is just the first step for CoCart to evolve. More details will be shared in the next news post.

If you have a comment or suggestion for moving the API endpoint, please leave your comments below.

Thank you for reading.