CoCart Get Cart Enhanced v2.0 Release Notes

This is the first release note post for CoCart Get Cart Enhanced. It introduces a couple of things. First checking the cart contents and applied coupons.

Validity of the items and stock is checked before returning the cart. The same for the coupons. This gives a more realistic cart in real time before the order is made and allows you to inform the customer should any item or coupon no longer be available or valid.

Second, is to give developers a preview of the new default cart response coming in CoCart v3.0 API v2.

What’s different and how do I preview?

Over time this add-on has been updated to improve the response based on the feedback by it’s users. One thing in particular that developers wanted was not to have the product prices and totals pre-formatted.

This suggestion allows more control, which means adding more information like the currency used for the store.

Default cart response with a single item added to the cart.

To preview the new cart response for CoCart v3.0 API v2, you need to use the filter cocart_preview_api_v2. You can copy the and paste the code below.

add_filter( 'cocart_preview_api_v2', function() { return true; });

Compatibility

This release also makes it compatible with v2.8 of CoCart Lite and small minor fix for those who are already using PHP 8. It’s also been tested with WooCommerce 4.8

Warning

Previewing the new cart response is still a working progress and is by no means complete. Use only for experimenting and to provide feedback.

Hope you enjoy and have a good X-mas. ?

CoCart Lite v2.8 Release Notes

Excited to announce that CoCart Lite 2.8 is now publicly available! This is a minor release so everything is backwards compatible with the previous version.

As always, it is recommend to create a backup of your site before updating.

What’s new in CoCart v2.8?

Only one small enhancement was made for the load cart from session for the web feature and that is to load the chosen shipping method.

Compatibility

As always there will be releases that add compatibility for changes made in WooCommerce. This time being mainly with WooCommerce v4.8 and WooCommerce Admin v1.7

Minimum requirement changes

These are the new minimum requirements in order to run CoCart. This ensures that new features added to CoCart work with these minimum requirements and the latest WordPress and WooCommerce releases error free.

  • WordPress now needs to be v5.3 minimum.
  • WooCommerce now needs to be v4.3 minimum.

Support for CoCart Lite will not be provided for sites running any lower than these minimum requirements.

In the future the minimum requirement for PHP will be bumped from 7.0 to 7.3

PHP 8 was released last week and so far there has been no issues reported which is great and works really fast which is what you need for a REST API.

Database changes

This release does not introduce any changes to the database.

Documentation

This release does not introduce any changes to the documentation.

CoCart Lite v2.7.3 Release Notes

Excited to announce that CoCart Lite 2.7.3 is now publicly available! This is a minor release with some fine tuning. Everything else is backwards compatible with the previous version.

As always, it is recommend to create a backup of your site before updating.

What’s new in CoCart v2.7.3?

I like to work on these minor releases more towards the developers now everything is getting polished so I hope you like it.

Wait what happened to v2.7.2? v2.7.3 is a hotfix release to v2.7.2. The release notes for v2.7.2 is below.

No More Empty Carts

One of the issues that was a challenge to understand was why additional empty carts were being created for guest customers that relied on the cookie method via the REST API. Now identifying the empty carts has been improved and prevents any empty carts from being created.

Only one cart for a guest customer is now created. ? This saves a lot of space in the database. That also means one of the filters that set an expiration for empty carts has now been deprecated cocart_empty_cart_expiration as it is not needed any more.

Cart Expiration Length

The default expiration length for a cart to expire has changed. Previously 30 days, now only 7 days. The expiration length can still be filtered if you wish.

WooCommerce System Status

Details on the carts was a little thin so I have added a new row showing how many carts are going to expire soon within the next 6 hours and out of how many in session.

Database changes

This release does not introduce any changes to the database.

Documentation

This release introduces some new filters and are added under “Session Management”.

  • cocart_is_cart_data_valid let’s you validate the cart data before a cart is saved in session.
  • cocart_set_cookie_options allows you to filter the cookie flags, which enables setting of samesite. ? – Only for those who use PHP 7.3 or above.
  • cocart_cookie_httponly on the httponly param on cocart_setcookie() with all the function parameters passed through.

CoCart Lite v2.7.1 Now Available

? This is a HOTFIX!

Two fields were overlooked when applying the new validation in the latest update v2.7 and that is the variation and cart_item_data fields when adding a product. Due to seeing the data returned as an array when it comes to validating those fields internally, I thought the fields should be checked as an array but all this time it’s been an object that is passed via those fields so my bad. ?‍♂️

I have also updated to the properties table for adding a product in the documentation too. The examples provided in the docs are still correct so you should not make any changes to your code. Just make sure you have this update installed.

You can download the latest release of CoCart Lite here or visit Dashboard → Updates to update the plugin from your WordPress admin screen.

As usual, if you spot any other issues in the CoCart Lite, please log them in detail on GitHub.

CoCart Lite v2.7.0 Now Available

Excited to announce that CoCart Lite 2.7 is now publicly available! It has been in development since September 2020 and has been updated with 57 commits and 2 contributors.

This is a minor release but does come with a small change which is easily correctable on your end. Further details about that below. Everything else is backwards compatible with the previous version.

As always, it is recommend to create a backup of your site before updating.

What’s new in CoCart v2.7?

This release fixes a few bugs (two of which have been fixed by the CoCart community) and improved backwards compatibility with sites still using WooCommerce lower than version 4.3.0. As always, CoCart is tested with the latest release (v4.6) of WooCommerce to ensure compatibility is maintained.

More Validation

More validation has been applied and now any data via the parameters are sanitized for more stable results.

FAIR WARNING!!! I made a grave error in the documentation when I released CoCart Lite version 2.1. In that release I introduced the ability to add an item to the cart via a SKU ID but forgot to correct the parameter table.

Some may have used this option already, others may have not. The parameter in question is the product_id which is no longer meant to be a integer value but a string value.

Since little validation was applied to the REST API at the time, this was not addressed properly.

This has now been corrected in the documentation so you need to make sure the value passed via the product_id parameter is a string and not integer when adding a product to the cart. Not changing this before updating CoCart Lite to v2.7 will result in an error. So please make the correction before updating.

Internal Use Supported

CoCart makes sure that the cart and session is not loaded on every REST API request that is not a CoCart route. After discussing a specific issue a developer was having, a new filter cocart_is_rest_api_request was added in order to allow developers to run their own API check-up should CoCart be used internally via a custom REST API of their own.

This will help with any functions being undefined from CoCart.

The Response

To provide more control over the response returned for each API (excluding logout, count-items and totals), I have created a new filterable response.

This can be used to return what ever you like should you not use any of the filters available before hand. In order to first use the new filterable response, you need to set this filter cocart_return_default_response to false so the new filtered responses are enabled.

For Developers

A new feature added is the cart key returned via the header response. This is helpful for frameworks that don’t support cookies.

Once the first item is added the cart key is returned under X-CoCart-API and can then be used to continue loading that cart via the cart_key parameter.

This is also helpful for when you are loading a cart in session to the web version of the store as you now know the cart key without looking it up.

Notable fixes and improvements

  1. Enhanced: Variable validation by removing parameters not used.
  2. Enhanced: REST API parameters sanitized and validated.
  3. Fixed: Undefined class constant E_WC_ADMIN_NOTE_MARKETING for those who are using WooCommerce lower than version 4.3.0. Thanks to @dmchale
  4. Fixed: If stock not available when updating item, return error. Thanks to @pauld8
  5. Fixed: Product ID validation should the ID not be present. Also returns correct product ID should SKU ID be used instead.

Database changes

This release does not introduce any changes to the database.

Documentation

The documentation has also been improved. Based on the user feedback, I have made things a little easier to navigate if you don’t use the search bar (under the CoCart logo).

I have done this by re-organized some of the content to be more categorized allowing you to quickly find specific things you want to do with CoCart or even support the use of CoCart within your own WooCommerce extension.

You will also now find quick links for applying specific filters. I have also included an example of adding a product to the cart via a SKU ID and updated the index JSON response to show the updated schema applied to some of the API’s.

It’s also important to know that I have made sure that the cart_key parameter is applied to all API property tables including the documentation for CoCart Pro.

You can download the latest release of CoCart Lite here or visit Dashboard → Updates to update the plugin from your WordPress admin screen.

As usual, if you spot any other issues in the CoCart Lite, please log them in detail on GitHub.

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.