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.
- WooCommerce API version 2 still works fine with CoCart.
- 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: yourdomainname.xyz/wp-json/wc/v2/cart/
When version 2 is made available, the new endpoint will be like so: yourdomainname.xyz/wp-json/cocart/v1/cart/
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.