CoCart v2.6.0 Release Candidate 1

CoCart is getting better and by that I mean with backwards compatibility, listening to users feedback and optimized better for future releases of WooCommerce.

WooCommerce 4.5 will be released on the 8th September which CoCart will release v2.6.0 just hours before so you can update with ease.

WooCommerce decided to bring back their REST API to the core of WooCommerce which changed a few things with the loading of the REST API but also made it better for CoCart Lite and the coming update of CoCart Pro. 💜

With that change I was able to evaluate the code base for CoCart Lite and make some adjustments to keep CoCart maintained as is but opened more opportunities, some based on what my users have been asking for.

One thing I did apply is to check the site environment before CoCart is activated. This way users are actually notified if the environment does not meet the plugin minimum requirements before activating.

Previous notifications were added for WordPress and WooCommerce only telling users they had to upgrade either but not the environment.

While checks are in place to prevent the plugin from causing any fatal error if either requirement don’t meet once the plugin is activated, checking the site environment was missing.

So now if any of the plugin requirements do not meet, the plugin will automatically deactivate. It also means I won’t have to worry of getting support tickets from users who don’t have those minimum requirements.

I have also given site owners a little more control over CoCart which can be controlled via their wp-config.php file. This ensures only the site owner can perform certain actions.

Again this is a minor release and no changes to the CoCart API have changed.

Changelog

  • NEW: Added backwards compatibility for when set_customer_session_cookie() function is called.
  • NEW: Site environment is now checked before plugin activates.
  • NEW: Plugin will not activate if CoCart Pro v1.1.0 or above is installed.
  • Enhanced: Plugin to be better optimized for future releases of WooCommerce and to allow it to be packaged with CoCart Pro so user’s will not require CoCart Lite if Pro is installed.
  • Improved: uninstall.php file and now will only clear plugin data and remove the database table if COCART_REMOVE_ALL_DATA constant is set to true in user’s wp-config.php. This is to prevent data loss when deleting the plugin from the backend and to ensure only the site owner can perform this action.
  • Improved: Handling of admin menu by moving to it’s own class.
  • Tweaked: Admin notices to not redirect only to the plugins page once notice is dismissed. Will redirect to the current admin page.
  • Dev: Introduced the ability to white label the plugin. Meaning hide CoCart from the backend. (Admin menu, plugin links, plugin notices including WC admin inbox notices and WC system status information). All you have to do is set a constant COCART_WHITE_LABEL to true in user’s wp-config.php file.
  • Dev: New filter cocart_authenticate to override the determined user ID when authenticating. NOTE This will only be active if not already authenticated.
  • Tested: Compatible with WooCommerce v4.5.0

Testing

If you’d like to dive in and help test this new release, a handy CoCart Beta Tester allows you to download the latest beta version or release candidates from the CoCart GitHub repository before final release.

If you discover any bugs during the testing process, please let me know by logging a report in GitHub.

Thanks to all of my testers and contributors!

CoCart Needs You

CoCart now needs your help more than ever for the next major update v3. Your feedback has been great but for the next API I want to take it a step further and request your participation in it’s development.

CoCart is designed for developers and for v2 of the API, it needs to be developed by those developers who use CoCart.

Originally, my plan for CoCart v3 was to introduce a major re-write of the cart system that the current API relies on. However, that was because at the time I was figuring out on how to support guest customers with the default WooCommerce session handler.

Now that problem has been solved without the need of a major re-write, we can move on to the actual responses developers require.

The most requested to improve CoCart was additional information returned for the cart and for certain fields to be formatted a certain way. Well now is your chance to actually add those details yourself so the cart returns what you need out of the box without the need to use filters.

That doesn’t mean that filters are being removed. There will always be something unique that a developer will require that is not for all.

So what can I add?

The new API is not to focus on adding new core features but to add support where needed and to format data the right way that is compatible for all frameworks without the need to re-format the data again after you get the response.

How do I get involved?

It’s actually fairly easy. All that you require is a GitHub account, fork the CoCart repository and contribute to the v3.0.0 branch with your pull request.

An enhanced issue must be made before hand explaining in detail what it does and why it should be added.

There are also issues already created that may need a PR so if I have not started on those your are welcome to go ahead and try working on one yourself.

I will then review and possible respond with a comment before deciding to merge it. If your PR gets approved, send me your WordPress.org username and I will add you as a contributor when v3 is released.

That’s it. That simple.

So test out what the new API has so far and get coding.

FYI, the changelog will provide some documentation as to what is new.

If you have any questions. Leave it in the comments section and I will get back to you asap.

WordPress 5.5 REST API Changes

WordPress v5.5 is just around the corner and introduces a change to the REST API that affects how public API’s are called. What does that mean? To put it simply, the WordPress core REST API is a private API which requires a permission check before the called API can return any data.

Because this happens without any warning to the user, if the permission callback is unintentionally omitted or misspelled, the endpoint can end up being available to the public. Such a scenario has happened multiple times in the wild, and the results can be catastrophic when it occurs.

https://make.wordpress.org/core/2020/07/22/rest-api-changes-in-wordpress-5-5/

So what does that mean for CoCart? Well nothing major. However, as CoCart is a public API, the use of adding a permission_callback was not needed before but without it when used with WordPress v5.5, it will now cause all the REST API routes to trigger a _doing_it_wrong() warning (see #50075).

CoCart v2.5.0 is a minor release and adds support for the coming change made to the REST API in the WordPress v5.5 to allow CoCart to still work as a public REST API.

No changes have been made to the CoCart API itself.

Just made sure that each route is using the permission_callback correctly so the REST API returns error free. This is the same for CoCart Pro and it’s add-ons.

If you are still using the legacy API wp-json/wc/v2/cart, when you update WordPress to v5.5, you will no longer be able to use it as it will no longer register.

I highly recommend that you update to the latest API version of CoCart.

Luckily that is only 15.5% of the user base which has slowly been updating to CoCart v2.

In preparation for the release of WordPress v5.5, I have a release candidate that I wish for you to test should you be testing the latest beta or nightly build of WordPress v5.5

WordPress v5.5 is scheduled to be released on 11th August so I’m looking at releasing CoCart v2.5.0 on the 10th August so you have a day in-advanced to update so you are ready.

CoCart v2.2.0 is now available!

June has been a busy month both in the world and development for CoCart.

Finally got guest customers supported and 5 small releases that provided fixes along the way that ensured 100% compatibility with WooCommerce’s latest release and conflicts found on the frontend.

I now have one WooCommerce extension officially supporting CoCart and another on the way.

Feedback again has been tremendous and your constant support towards me so that I am able to provide you what I need has been a great help. ?

It’s especially nice to see customers donating more for the constant updates I have been giving. If you like to give, you can support me by buying me a coffee or simply purchase CoCart Pro while it is on sale until the end of June.

Today I have released v2.2.0 which is a minor release (which means everything is backward compatible with the previous version) that adds support for CORS headers should you need them set and a few tweaks to the plugin just to make it a little bit better.

As always, I recommend creating a backup of your site before updating.

Enjoy!

Changelog

  • NEW: Support for allowing all cross origin header requests to pass. Requires cocart_disable_all_cors filter set to false to enable.
  • NEW: Returned response after adding an item now returns product name, title and price just like the cart.
  • Tweaked: Improved validation for a variable product to return the product name correctly if variation attributes are missing.
  • Tweaked: Made sure that we check if we are making a request for CoCart API only.
  • Tweaked: CoCart logger will only log if WP_DEBUG is also set true.
  • Dev: New filters added for returning additional item data once added to cart.

CoCart v2.1.2 Release Candidate 5

Final release candidate for v2.1.2 introducing support to prevent caching CoCart if you have WP REST API Cache plugin installed.

Testing has been going well so I am confident to release on the 4th June, 2020

Changelog

* NEW: Prevent CoCart from being cached with [WP REST API Cache plugin](https://wordpress.org/plugins/wp-rest-api-cache/).
* Tweaked: Check if product exists first before validating further.
* Tweaked: `cocart_update_cart_validation` filter passes `$current_data` fully.
* Tweaked: If validation for adding or updating item returned an error return error response.
* Dev: Added schema for cart route.
* Dev: Added schema for adding item route.
* Dev: Passed `$product_type` for `cocart_add_cart_item_data` filter.

If you discover any bugs during the testing process, please let me know by logging a report in GitHub.

Look forward to your feedback.

Thank you.

?