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.
Greetings all! WooCommerce 3.6 was released a couple of days ago which provided a performance improvement which is great, however, due to that improvement the Cart was no longer loading during REST API requests.
So for any of you who are already using CoCart and updated to WooCommerce 3.6, CoCart would die. Not cool!
But don’t worry for I have a patch in this release candidate that fixes the issue and requires your feedback to help me catch any further issues I may have missed before the final release.
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/
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.