Categories
Core

WooCommerce 4.0 is here!

Today we are excited to announce the availability of WooCommerce 4.0. The latest release of WooCommerce has been in development since January 2020, but a lot of improvements has been in the works since 2018. WooCommerce core has had 743 commits from 21 contributors, but we should also mention a huge amount of effort from the WC Admin team and the code that now becomes a part of the core with a history of 3500 commits from 45 contributors.

4.0 is a “major” release. This means that the version is not fully backwards compatible with sites running various versions of WooCommerce 3.x. Therefore, we recommend testing the upgrade on a staging site copy before upgrading your live store and creating a backup of your code and database. Please see this guide for more details.

What’s new in 4.0?

4.0 is the first major release of 2020 and we’re excited to include the new version of WooCommerce Admin in this release. WooCommerce Admin is the first step towards a more modern JavaScript-driven experience of WooCommerce core.

WooCommerce Admin

For readers of the WooCommerce Development blog, you have probably seen the initial announcement and later regular releases of the feature plugin. With the plugin being actively used on more than 1 million stores, we now believe the WooCommerce Admin is ready to be included in the WooCommerce core to bring a set of improvements to all store owners:

  1. New dashboard
  2. New and improved reports
  3. Improved notification experience
  4. New store management tools

WooCommerce admin provides much better reporting capabilities than previous generations of reports and allows for filtering, comparisons and overview how the store is doing in terms of sales, revenue, which products are the most popular/highest-grossing, adds capabilities for improved customer management and analytics.

Please note that we’re not removing the old reports at this point. We will deprecate those at a later point and decommission them with enough notice to users and developers.

We’ve also made it very easy to export the data from the reports as csv to enable smooth interoperation with other systems.

Together with the WooCommerce admin, we’re bringing a new Activity panel with improved order management workflow and consistency between the desktop and mobile experience to all the customers.

Due to the JavaScript requirements, this experience will be available to all stores running WordPress 5.3+. Store running older versions of WordPress will have WooCommerce Admin automatically disabled.

Stay tuned for additional blog posts here that will detail how developers can extend the new WooCommerce Admin experience.

Action Scheduler 3.1

One of the underlying technologies that enabled WooCommerce Admin is Action Scheduler—the background job runner already used in WooCommerce core. The 3.1 version that we’re including in WooCommerce 4.0 is a new, more performant version of Action Scheduler which utilizes custom tables to provide a great experience even on stores with large volumes of orders and posts in the database.

Ensuring a stable Action Scheduler in WooCommerce is crucial, and we’re happy to see that more than 10,000 sites are already using it together with the WooCommerce Subscriptions 3 plugin.

If you previously experienced any problems with Action Scheduler, the migration guide for WC Subscriptions 3 might be a useful resource.

New Onboarding Experience

Starting a shop can be a complex and confusing experience, and we believe we can help our new customers get their shop up and running faster and with greater ease. Therefore, 50% of our new customers would be able to try out a new onboarding experience.

Additional Updates

In addition to the new WooCommerce admin, you will find the following enhancements in 4.0:

  • Enhancement to the Order edit screen
  • Latest fixes of WooCommerce Blocks package
  • Updates related to Brexit and VAT
  • Improvements to email handling
  • Optimizations for saving variations and Cash on delivery payment gateway

Beyond these enhancements, the release also contains some tweaks, new hooks, and fixes – all of which you can find out about in the readme.

Upgrading to 4.0

WooCommerce 4.0 is a new major version which means it’s not fully backward compatible with previous WooCommerce versions. However, the breaking change we’re introducing is only on the database level of Action Scheduler and thus the upgrade should work well for most customers. We recommend testing and backing up prior to upgrading and following our upgrade guide.

If you want to learn more about the Action Scheduler upgrade process, we recommend having a look at the upgrade guide for WC Subscriptions plugin (which also includes the new version of the same library).

There are a few post-update database upgrade routines that need to run after updating. On very large databases we recommend running the upgrade routine with the WP CLI command wp wc update instead of through the admin interface.

If you’re a developer and missed the beta and release candidate (RC), the following information may be useful:

Deprecated Functions and Methods

  • countries_using_vat got replaced by WC_Countries::get_vat_countries

Template File Changes in 4.0

The following template files have been updated in this release

FileChanges
cart/shipping-calculator.phpWording of Country updated to Country / Region in shipping calculator
global/quantity-input.phpAdded placeholder attribute for the quantity input
emails/customer-reset-password.phpAdded missing tag for the end of paragraph
emails/email-styles.phpUpdated img CSS
emails/email-header.phpSet table width to 100%
single-product/add-to-cart/grouped.phpAdded placeholder attribute for the quantity input

How 4.0 was tested

We released 4.0 beta.1 on February 10th, 2020, which was followed by the release candidate 1 on February 26th and later by release candidate 2 on March 6th. During this time we:

  • Tested upgrade from WC 3.4, 3.5, 3.6, 3.7, 3.8 and 3.9 to 4.0 as well as clean installations.
  • Tested our own extensions and themes.
  • Analyzed compatibility of all marketplace extensions with WC 4.0.
  • Tested on the most popular hosting providers.
  • Tested using the most popular premium themes.
  • Performed managed upgrades for actual customers on staging sites to pick up on any conflicts or bugs before the public release.
  • Tested and updated WooCommerce.com itself.

Much 💜 to all the contributors

Finally a big thanks to everyone in the community who has contributed via issue reports, fixestranslation, testing, supporting other users or simply spreading the word.

peterfabian claudiosanches rodrigoprimo ObliviousHarmony vedanshujain
peterfabian claudiosanches rodrigoprimo ObliviousHarmony vedanshujain
juliaamosova rrennick jeffstieler denho TimBHowe
juliaamosova rrennick jeffstieler denho TimBHowe
psealock jacoswan rohanvakharia joshuatf mgibbs189
psealock jacoswan rohanvakharia joshuatf mgibbs189
gerdneuman LevinMedia timmyc mikejolley picocodes
gerdneuman LevinMedia timmyc mikejolley picocodes
sultann smachi Lin-Buo-Ren
sultann smachi Lin-Buo-Ren

57 replies on “WooCommerce 4.0 is here!”

Thanks for the great effort! Any important change from rc2?(at the database level) I’ve tested upgrading to rc2 from 3.9.3 with no problems. Is the Spanish translation ready too? Thanks in advance!

Liked by 1 person

Hi Daniel,

no database changes from rc2, we’ve just updated a couple of strings for better translation and documentation.

Hope your upgrade goes smoothly!

Cheers,
Peter.

Liked by 2 people

Updated and tested my plugin and set WC tested up to: 4.0
but still says “Not tested with the active version of WooCommerce”

Like

Hi John, we haven’t done many changes in the internationalization code, so it probably will, but it’s always better to check with the developer of the plugin and backup before updating.

Like

REST API is the same version as it was in 3.9 branch, so there were no changes. REST API should work 100%, please let us know if you run into any problems.

Liked by 2 people

This is a total mess. How do I turn off the Dashboard and those reports? And that Orders and Stock banner? They drain resources in the backend. Emails are badly broken – one some sites push out blank emails; on others the emails are a garbled mess of HTML tags and missing line items.

Liked by 1 person

Not to be the only downer here. I’m sure there is lots of good stuff. But why push an update when the ecosystem isn’t ready? Really, I’ve even tried to circumvent these updates but I had a staff member “not get it” and push updates to a bunch of sites. Which is a huge problem. What is the point, if admins need to test this pre-prod to release this publicly where an auto update can install it? It really doesn’t make sense and I’m sure I’m not the only one it caused issues for. Make it available for download so people can test it out under their control, don’t push it for mass use when the majority of plugins aren’t even ready or marked compatible.

Like

Hi Sean,

Thanks for reaching out. As with other releases, also with this one, we had a one-month pre-release period: 2 weeks for beta and 2 weeks for release candidate. During this time, we’ve worked with both internal and external/3rd party developers to let them know about the changes and tried to give early notice about this update.
The honest truth is, though, that very few people actually care about pre-release versions and if we should wait with releases until the plugins are ready, we would not be able to release, ever. We have people reaching out to us now who run WooCommerce 1.6. We get messages from plugin authors who are starting to use the database abstraction layer after almost 3 years since WooCommerce 3.0 went out.
That being said, we are actively trying to improve the situation, as we recognize that plugin conflicts are perhaps the most common problems our customers face. We’ve put into place an automatic code scan over all marketplace plugins to check for incompatibilities. We’re testing on the most common hosting platforms with the most common plugins and premium themes. Should we be doing more and be better? Certainly! Do we plan to? We sure do!

Liked by 4 people

This is awesome. Is there a snippet to remove wp-admin dashboard and replace it with woocommerce analytics? I have no need for default wp dashboard and would like to have woocommerce as my default page after wp-admin login.

Like

Hi, please try to use version 4.0.1, we’ve added back more lax matching for shipping regions.

Like

My theme was using the “ajax style” add to cart, my single product template for both simple and variable products had a button with the “add_to_cart_button” class and data attributes with quantity and product/variation IDs. After updating WC to 4.0 I noticed that the quantity was ignored (i.e. even if I asked for 5 units of a product only one was added) and, even worse, on variable products, no matter the variation I picked, only the “generic” parent product ended up in the cart. I compared the two versions of assets/js/frontend/add-to-cart.js from 3.9.3 vs 4.0.0 with a DIFF tool and found that their only difference (apart for a comment) is that the latter lacks the following:

// Fetch data attributes in $thisbutton. Give preference to data-attributes because they can be directly modified by javascript
// while .data are jquery specific memory stores.
$.each( $thisbutton[0].dataset, function( key, value ) {
data[ key ] = value;
});

I don’t know if this was intended for some reason I don’t understand, but it’s completely breaking my theme so I’m forced to roll back to 3.9.3. Please correct it if it was a mistake or let me know what the “new” way of doing that would be. Thanks a lot

Like

Hi lupusyon, this should be fixed in 4.0.1. Can you please try if you’re still experiencing the issue with the new version?

Like

I’m still experiencing the issue with 4.0.1 because its add-to-cart.(min.)js is identical to the 4.0.0 version, no changes at all there. But I realized that I made a mistake, the script lines I thought were missing from 4.0.0 were in fact ADDED to that version and were missing in 3.9.3. So I realized that my theme was adding quantity and variation ID to my custom “add to cart” button via jQuery .data(‘key’, ‘value’) thus preventing WooCommerce’s new approach (which fetches those values via $thisbutton[0].dataset instead of $thisbutton.data) from reading those values correctly. Therefore I modified my script and used vanilla JS to update the button, by changing, for example, THESE:

jQuery('#mybuttonelementname').data('quantity', newQuantity);
jQuery('#mybuttonelementname').data('variation_id', current_variation_id);
jQuery('#mybuttonelementname').data('product_id', current_variation_id);

Into THESE:

document.querySelector('#mybuttonelementname').setAttribute('data-quantity', newQuantity);
document.querySelector('#mybuttonelementname').setAttribute('data-variation_id', current_variation_id);
document.querySelector('#mybuttonelementname').setAttribute('data-product_id', current_variation_id);

Now it’s working the way it was supposed to. Thanks.

Liked by 2 people

My client just switched ot V4.0.1 and immediately had problems with our app getting a 500 Internal Server Error. We did not know they were going to update and not even sure what version they had before.

We were sending this URL
https://xxxx.com/wp-json/wc/v1/orders?status=to-download&orderby=id&order=asc&per_page=100&consumer_key=ck_xxxxx&consumer_secret=cs_xxxxx&page=1

I asked them to try to change the v1 to v2 or v3 but haven’t heard back.

Any clue as to why it got the 500 error.

Like

Hi Peter,

I have a problem after upgrading to v4.0.1 – I can’t remove or replace a product image (old image is “stuck”), nor I can view the Media library content (endles loading.. and no images to see).

When I deactivate Woocommerce, media library works Ok. Also, when newest version of Woocommerce is active, WP backend is slow.. That wasn’t the case with v3.9.3.

What could be the problem?

Like

Hi Alex, rather difficult to tell what the issue might be without having more details. Please check out our troubleshooting section in the documentation, especially the plugin conflict resolution might help. As I haven’t encountered a similar report about images yet, it’s possible that you’re using some uncommon plugin?

As for performance, WC 4 includes more analytical features, so it uses more resources when looking at analytics screens, but general work e.g. with Orders or Products, or the front end for users should not be affected much. We’re going to look into different optimizations in the upcoming releases, but in case you’re experiencing large slowdowns, please reach out to our support and we should be able to help you out.

Like

Hi Peter,

Great update! Can you please advise as on two websites the analytical charts on the new dashboard is not loading. What I know what to check or any known fix?

Like

Hi Marc, please check your logs under WooCommerce > Status > Logs to see if you spot any errors there. Also, you can start your browser’s dev tools to have a look at the requests to the backend to see if they return an error code or if there is a timeout, or potentially something else at play. Please contact our support with more information if you want our Happiness Engineers to help you out.

Like

hello
so since we updated to 4.0 our check does not work. It gives us a message that says “an error has occurred please try a different form of payment” I think someone is working on it but it has been like 3 days that we have not been able to take orders and it is really frustrating. We spoke with our payment gateway and everything is fine on that end so it has to be woo commerce. anyone else having this issue?

Like

Hi,
Love Wooommerce, but since updating yesterday to 4.0.1 from 3.8, my website is very slow. Most of the actions take forever and the icon in the tab just keeps spinning. I have disabled all of the plugins, only Woocommerce is active. How can I find help? My website is not yet live, but we wanted to be very soon.

Liked by 1 person

Hi Susan, Sorry to hear you’re experiencing problems. We’re including some good performance improvements in 4.1 that is coming out at the beginning of May. Until then, I would suggest to temporarily increase your server specs if that is an option.

Like

In the meanwhile, is there a temporary fix? (I chatted with one of your support-agents and we managed to remove the message by entering a parameter to the link, which closed the “Thank you”-message, but I cannot remember it anymore)

Like

Great update …one annoying thing.

The dashboard popup “WooCommerce database update executed, WooCommerce data update done. Thanks for installing the latest version! is not hidden after clicking the button “Thanks!” (French version “Merci !) In fact there are two buttons Thanks ! (For info I have a french language version version”)

It keeps popping up and when I click the “Thanks !-button I get a white screen with the message :
The action failed. Please refresh the page and try again.
In french : L’action a échouée. Veuillez rafraichir la page et essayer de nouveau.

When returning to the dashboard the message is still there.

Can this be solved ?

Thanks

Like

Hi Le Bétuliculteur, thanks for reporting the problem!
We’ve seen similar reports and will be including a fix for this soon.

Liked by 1 person

In the meanwhile, is there a temporary fix? (I chatted with one of your support-agents and we managed to remove the message by entering a parameter to the link, which closed the “Thank you”-message, but I cannot remember it anymore)

Like

Hi decentris,

You can run a SQL query
UPDATE wp_wc_admin_notes SET status = 'actioned' WHERE name = 'wc-update-db-reminder'

to get rid of it. Please note you might need to change the wp_ to your WP db prefix, based on your WordPress configuration.

Liked by 1 person

WC4 is a problematic product, going further away from the clean and lean ecommerce platform as we know it. The most prominent problem (for me) is analytics integration which is slowing down WP backend immensely. That is not acceptable – this feature should be optional and not mandatory, I have GTM and GA for that. Solution is, for now, to disable analytics by adding this filter to the site:

add_filter( ‘woocommerce_admin_disabled’, ‘__return_true’ );

Update from WC 3.x.x is unstable, and various problems could accure. Solution for me was to:
– Update other plugins
– Then disable them ALL
– Update Woocommerce
– Apply mentioned code
– Activate turned off plugins one by one

I’m hoping that developers of this great plugin will come to their senses, clean WC from unnecessary code and features, and give us (millions of users) a stable product.

Liked by 1 person

Hi Alex, thanks for your feedback. We are actively trying to improve the experience and performance for the 4.1 release that should be snappier and not slow down your store. It’s coming out at the beginning of May.

Like

Thanks Fabian for your reply. Of course that I’m expecting nothing less from WC developers then to continue good work on WC plugin.
Although, my opinion on the analytics stays – this feature needs to be optional. Google analytics does the great job, especially with Enhanced e commerce feature. Try to replicate this to WordPress website and You’ll have more problems then the benefits.
My suggestion for You is to offer analytics as a separate plugin, and improve him as much as you can – then the WC community will adopt this feature naturally. Making something mandatory provokes only rejection, especially if it’s not working right.

Liked by 1 person

Comments are closed.