How to enable revisions in WooCommerce

If you're new to WooCommerce you probably noticed that WooCommerce products don't have one great feature that WordPress pages and posts have - revisions.

Revision is a special post type in WordPress which let's you have multiple versions of your posts or pages saved in database. For example - if today you made a change to page, and for some reasons you want to revert back to yeasterday's version of the same page, you can use revisions for that.

By default WooCommerce - the most popular e-commerce plugin, does not have revisions enabled by default. There are also no setting for enabling revisions from WordPress admin panel. But you can still enable WooCommerce product revisions by adding a tiny bit of code to your WordPress theme. Here's how you do it.

How to enable revisions for WooCommerce products

If you want to enable revisions in WooCommerce one of the easiest and fastest ways to do it is to edit your WordPress theme's functions.php file:

  1. Go to Appearance >> Theme File Editor.

  2. Select functions.php file on the right side of the page.

  3. Scroll to the bottom of that file and code you see below to the end of the file.

function imakeitwork_woo_revisions($args) {
     $args['supports'][] = 'revisions';
     return $args;
}
add_filter( 'woocommerce_register_post_type_product', 'imakeitwork_woo_revisions' );

Here's how it should look like (previous code in functions file might be different in your screen if you're using different WordPress theme):

how to enable revisions in woocommerceOnce you add that code and Update File revisions will be activated for WooCommerce products.

By the way, if you want to create a simple plugin for adding revisions to WooCommerce (instead of using theme's functions.php file) you can do it easily in just a few minutes. Here's example how you can create custom WordPress plugin - just use the code above instead of the one in the plugin tutorial.

Where to find WooCommerce product revisions

Once you enable revisions in WooCommerce you may not find them once you open a product yet. And the reason is simple - there are no revisions saved to your products yet.

Once you make a change to a product and save it, then you'll be able to see revisions at the top right of the product page:

woocommerce product revisionsThat's it - your WooCommerce products now have revisions.