Categories
CoCart Core

CoCart Lite v2 now released

Today marks the first release of the new API that introduces it’s own namespace, major improvements including better responses and new ways to return a response to reduce API requests in your app.

If you have been following the development of version 2 then you already know that for developers it is now possible to filter in additional data.

To share some of the examples on what you can do with CoCart v2 I have created a side plugin that provides various tweaks that you can apply to further enhance CoCart to your needs.

Feel free to contribute other examples that you have applied yourself.

The API

The new API uses the same parameter properties and includes some new ones. The route for the API has also changed including some of the endpoints.

Below you will see a comparison of the route and endpoint changes.

Legacy API

  • wc/v2/cart
  • wc/v2/cart/add
  • wc/v2/cart/calculate
  • wc/v2/cart/cart-item
  • wc/v2/cart/clear
  • wc/v2/cart/count-items
  • wc/v2/cart/totals

New API

  • cocart/v1/get-cart
  • cocart/v1/add-item
  • cocart/v1/calculate
  • cocart/v1/clear
  • cocart/v1/count-items
  • cocart/v1/item
  • cocart/v1/totals

You can still use the legacy API if you are already using it and not yet ready to use the new API but you will miss out on all the new enhanced features.

Upgrading is easy. As I said, the new API uses the same parameter properties so switching over is a breeze. The documentation provides all the details on the new parameter properties.

Minimum Requirements

While it is still possible to use CoCart with WooCommerce v3.X.X it is better to be updated to at least v3.6.X for better performance and security. With the upcoming release of WooCommerce 3.7, I will be updating the minimum required version of WooCommerce to 3.6 in the future.

I have to do this to keep up with the code changes within the WooCommerce ecosystem and to be able to deliver the best experience for my users.

If you have any questions or feedback around the decision for this change, please feel free to leave them in the comments.

Changelog

Here is the full changelog on what’s new in CoCart.

  • NEW: REST API namespace. CoCart is now an individual API and is no longer nested with WooCommerce’s core REST API.
  • NEW: Check to see if the cart is set before falling back to the cart in session if one exists.
  • NEW: Get a specific customers cart via their customer ID number.
  • NEW: Product title also returns besides just the product name when getting the cart.
  • NEW: Product price also returns when getting the cart.
  • Changed: Filter and Action Hook names in new API.
  • Improved: Complexity of functions for better performance and usage.
  • Tweaked: Added checking for items already in the cart.
  • Tweaked: Check if cart is empty before removing an item.
  • Tweaked: Responses for adding, updating, removing and restoring items to return whole cart if requested.
  • Tweaked: Responses for updating items to return the quantity of item along with message.
  • Tweaked: Totals can now return once calculated if requested.
  • Tweaked: Totals now return from session and can be returned pre-formatted if requested.
  • Tweaked: New option to refresh cart totals once item has been added or updated.
  • Dev: Added action hooks for getting cart, cart is cleared, item added, item removed and item restored.
  • Dev: Added filter to allow additional checks before the item is added to the cart.
  • Dev: Added filter to apply additional data to return when cart is returned.
  • Dev: Added filter to change the size of the thumbnail returned.
  • Dev: Added new option to return cart raw if requested.

Progress on CoCart Pro

Now that CoCart v2 is released you can expect to see CoCart Pro very soon.

If you look at the features page, you will already see some of the features that are coming to CoCart Pro. Development on the remaining core features that I have planned are near completion.

With plans for supporting popular official WooCommerce extensions in future updates, support for WooCommerce Subscriptions (which is by far the most popular) is the first supported.

Prices for CoCart Pro has already been released and if you have signed up to the newsletter you will be given a discount for the first year once launched so don’t miss out.

Showcase your store

I’m looking to showcase stores built using CoCart whether it’s a web app, desktop app or a smartphone app for Android and iOS. If you are interested in being featured, please contact me to discuss.

That’s it.

Enjoy CoCart v2 🙂

%d bloggers like this: