CoCart Lite v2.9.1 Release Notes

Excited to announce that CoCart Lite 2.9.1 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.9.1?

This release fixes a problem with merging cart contents together. It’s a feature that WooCommerce provides in the core and one that was not working out of the box with CoCart.

What is this feature for? Well it’s simple. The feature is triggered when a customer logs in but started as a guest. They already added items to the cart but also have items added to the cart as a registered customer.

So for any items that are not already in the cart, they are merged together. Now you only have one cart of all the items you added. This will then destroy the guest cart as it is no longer needed.

Pretty cool. 🙂

In addition to this fix. A change has been made to further enhance the API for headless development. The cookie that stores the cart information now adds the samesite attribute to None. This article explains more about SameSite Cookie Attribute.

To help with those who wish to change the default attribute value, a new filter cocart_cookie_samesite has been introduced to allow you to override it. Before this attribute was added the default value was lax after 20th February 2020 if the attribute is not applied.

This cookie change is only available for those who use PHP 7.3 or above and will be the minimum requirement for CoCart v3 once it is released so I recommend that you update to PHP 7.3 or higher soon.

Why was this cookie attribute added so late? To be honest it just got forgotten about due to Covid-19, personal health and working on other improvements for CoCart. I only just recently got reminded about it. 🔔

If you have tips or feature requests to help CoCart improve for your development then please send me feedback or make a enhancement request via the GitHub repository where I can manage things better.

I like to thank Joel for this release who spent a little of his weekend helping me to get this done.

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.9.0 Release Notes

Excited to announce that CoCart Lite 2.9.0 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.9?

This release is for preparation for CoCart v3 in order for the database upgrade to work as it should.

If you don’t update CoCart to this release first, then when it comes to upgrading to v3, the database will be upgraded automatically as it will not know the version of the CoCart database.

This is important for large stores as they will need time to backup the database before proceeding.

As a bonus, I fixed an issue that prevented CoCart from being installed correctly on a multi-site environment. So CoCart now supports multi-site environments. 🥳

Enjoy!

Database changes

This release does not introduce any changes to the database.

Documentation

This release does not introduce any changes to the documentation.

CoCart Pro v1.0.0-rc.5 Release Notes

A minor release for CoCart Pro just to patch a few things until the next big update for CoCart Pro is released.

Those who are on there free trial will not get this update. If you like CoCart Pro activate your subscription and the update will be added to your account.

Changelog

  • Fixed: Forced the formatting of the returned applied coupons to return as an array always even if a coupon was deleted at some point.
  • Dev: Disabled experimental WordPress auto update features.
  • Dev: Disabled plugin review and beta notice temporarily until new admin notice system in CoCart v3.0 is supported.
  • Dev: Removed the use of cocart_getting_started_doc_url filter no longer used in the core of CoCart.
  • Dev: Updated dependencies used for developing CoCart Pro.
  • Compatible with WordPress 5.7
  • Compatible with WooCommerce 5.1

    New Minimum Requirements
  • WordPress 5.4
  • WooCommerce 4.3

CoCart JavaScript Library v1.0.0 Release Notes

Updated: 25th January 2021

Excited to share finally a JavaScript library to help with your headless store development. Much like the WooCommerce JavaScript Library, this one is designed so authentication is optional.

Where to get it?

You can install the JavaScript Library simply running this command in your terminal.

npm install --save @cocart/cocart-rest-api

If you wish to contribute to the project you can access the GitHub repository.

Example of Use

// import CoCartAPI from "@cocart/cocart-rest-api"; // Supports ESM
const CoCartAPI = require("@cocart/cocart-rest-api").default;
 
const CoCart = new CoCartAPI({
  url: "http://example.com"
});

You can decide to use CommonJS (CJS) or ECMAScript Modules (ESM).

Since there is only one API version at this time there is no need to define the version when setting up your API constant. All that is required is the URL of your site.

FYI

This library will NOT support the LEGACY API of CoCart.

If you are authenticating a customer then you need to set the consumerKey (a.k.a Username) and consumerSecret (a.k.a Password).

// import CoCartAPI from "@cocart/cocart-rest-api"; // Supports ESM
const CoCartAPI = require("@cocart/cocart-rest-api").default;
 
const CoCart = new CoCartAPI({
  url: "http://example.com",
  consumerKey: "sebtest123",
  consumerSecret: "happycoding24"
});

You can then proceed to use the library to make requests like so.

Get Cart

// Get Cart
CoCart.get("get-cart", {
  thumb: true, // Returns product thumbnail
})
.then((response) => {
  // Successful request
  console.log("Response Status:", response.status);
  console.log("Response Headers:", response.headers);
  console.log("Response Data:", response.data);
})
.catch((error) => {
  // Invalid request, for 4xx and 5xx statuses
  console.log("Response Status:", error.response.status);
  console.log("Response Headers:", error.response.headers);
  console.log("Response Data:", error.response.data);
})
.finally(() => {
  // Always executed.
});

Add item to cart

// Add item to cart
CoCart.post("add-item", {
  product_id: "32",
  quantity: 1
})
.then((response) => {
  // Successful request
  console.log("Response Status:", response.status);
  console.log("Response Headers:", response.headers);
  console.log("Response Data:", response.data);
})
.catch((error) => {
  // Invalid request, for 4xx and 5xx statuses
  console.log("Response Status:", error.response.status);
  console.log("Response Headers:", error.response.headers);
  console.log("Response Data:", error.response.data);
})
.finally(() => {
  // Always executed.
});

You can view other examples provided in the documentation. Simply click on Node.js in the top right corner to see the command.

CoCart Lite v2.8.3 Release Notes

Excited to announce that CoCart Lite 2.8.3 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.3?

This is the last minor update for CoCart v2 or at least for this year I think.

What’s new is that multi-site networks now properly engage with the site admin once the plugin is activated on the network.

A few tweaks have been made so we don’t add the version of the plugin per site. All admin notices now show via the network admin and if you are new to CoCart, you are redirected to the getting started page in the network admin upon first activation.

Before network sites would only see “Plugin activated” which makes the site admin feel left out.

A couple of fixes were also made.

Headers were already sent when filtering rest_pre_serve_request. This appeared to only cause issues when you have WP_DEBUG enabled when using CoCart locally.

And finally, a few errors were not returning the status error in the correct format.

That is it. I hope you are doing well and have a good x-mas. ?

Database changes

This release does not introduce any changes to the database.

Documentation

This release does not introduce any changes to the documentation.