CoCart v2 Release Candidate 2

Another release candidate for CoCart v2. I’m not going to specify a release date but if there are no further major issues I will release it sometime this week with more details about CoCart Pro.

All details of the changes made to CoCart for v2 can be found here and links to the specific feature improvements made can be found here.

Before v2 is made available to the public I require your feedback for suggestions, issues or bugs that need to be squashed. View the new documentation available for details on the new API.

Please only test on a local environment or staging site. If you come across an issue, please report it via the GitHub repository where I can manage it more appropriately.

Thank you.

Changelog

  • Added refresh totals parameter to adding item.

CoCart v2 Release Candidate 1

Two days ago was suppose to be the release of CoCart v2 but a major issue occurred that was found last minute so I had to delay and I’m glad I did as this issue actually exposed a few invalid responses and sections that could be improved further.

Now the major issue is resolved and further improvements have been made, CoCart v2 is ready for real this time but before it is made public I would like you to test it out for me and report any bugs or issues you come across.

The documentation will be updated over the weekend but is 99% ready for CoCart v2.

Updated: 1st July 2019

Release Candidate 2 was released. See post for more details.

Thank you for your patience. 🙂

Changelog

  • WP_Error is no longer in CAPS
  • Added notes for translators and tweaked strings.
  • Corrected feature mentioned for CoCart Pro.
  • New totals override totals instead of another REST Response.
  • Added original price of product when getting cart.
  • Added more argument descriptions.
  • Optional argument corrections.
  • Return a response should specified cart item key not exist in cart.
  • Tweaked CSS for admin notices.
  • Ensure we don’t add a variation to the cart directly by variation ID.
  • Generate a ID based on product ID, variation ID, variation data, and other cart item data.
  • Added new option to refresh cart totals once item has been added.
  • Use self get_cart instead of cart class get_cart.
  • Added new option to return cart raw if requested.
  • Quantity of item increases if item already in cart. Responses improved.
  • Removed the need to format quantity value again when checking available stock.
  • No need to check if WC endpoint is requested.
  • Removed validate_callback for pre-formatted totals.
  • Made sure the cart item key parameter name is consistent.
  • Return cart parameter is no longer ignored.
  • Return cart item contents rather than boolean status.
  • Changed hook for loading controllers.

CoCart v2.0.0-beta.2

This release applies a couple of tweaks and one fix.

  • Fixed: $this error with getting cart to check if item is in cart.
  • Tweaked: Check if cart is empty before removing an item.
  • Tweaked: Re-ordered registry of routes to be in alphabetical order.
  • Updated: POT file.

Updated: 1st July 2019

Release Candidate 2 was released. See post for more details.

Release Date

I’m hoping to release CoCart v2 next Tuesday, 25th June 2019 so please test and report feedback for any issues before then.

P.S. Again, please only test on a local environment or staging site. If you come across an issue, please report it via the GitHub repository. Thank you 🙂

Coming in v2: Totals

Fetching the cart totals is one of the most important parts of the CoCart API and while you do get all the information you need, they were not always returned in the same format when it came to the actual totals and did not have the currency symbol applied.

I’m sure developers would have to convert the values and apply the currency symbol after fetching the totals which could also increase load time for their app with the additional code required.

For version 2, I wanted to make it faster and easier for developers by returning the results pre-formatted ready to simply display them.

All totals can now return as a string with the currency symbol automatically applied according to the store currency set in the WooCommerce settings.

To get these results, simply set the new property as true.

See documentation for example.

That’s it!

Feedback NO LONGER Required!

CoCart v2 is now available.

CoCart v2.0.0-beta.1

CoCart v2 is now ready and available for testing.

It’s now more powerful for developers to take full advantage of the REST API to add items and manage the cart.

Not only that, the API is now faster as it is separated from WooCommerce’s REST API and runs it’s own namespace with better returned responses to reduce API requests, more item data and getting a specific customers cart.

CoCart v2 is also backwards compatible so you can still use the current API available but unless you upgrade to the new API you will miss out on the new supported features.

FYI

It’s also recommended that you are using WooCommerce v3.6 or above for CoCart v2 to function properly.

Here is a comparison of the API routes.

Current 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

The new API still uses the same properties the only difference for some of them is the endpoint is renamed.

Before v2 is made available to the public I require your feedback for suggestions, issues or bugs that need to be squashed. View the new documentation available for details on the new API.

Updated: 1st July 2019

Release Candidate 2 was released. See post for more details.

Please only test on a local environment or staging site. If you come across an issue, please report it via the GitHub repository.

Thank you and enjoy.